Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

project_panel: Make the window deactivation test actually deactivate (#62724)

Mikhail Butvineedd20160f98
diff --git a/crates/project_panel/src/project_panel_tests.rs b/crates/project_panel/src/project_panel_tests.rs
index a4ff860f2eb..1c308d707a0 100644
--- a/crates/project_panel/src/project_panel_tests.rs
+++ b/crates/project_panel/src/project_panel_tests.rs
@@ -4577,15 +4577,26 @@ async fn test_rename_survives_window_deactivation(cx: &mut gpui::TestAppContext)
.read_with(cx, |mw, _| mw.workspace().clone())
.unwrap();
let cx = &mut VisualTestContext::from_window(window.into(), cx);
- let panel = workspace.update_in(cx, ProjectPanel::new);
+ let panel = workspace.update_in(cx, |workspace, window, cx| {
+ let panel = ProjectPanel::new(workspace, window, cx);
+ workspace.add_panel(panel.clone(), window, cx);
+ panel
+ });
cx.run_until_parked();
select_path(&panel, "root/file1.txt", cx);
panel.update_in(cx, |panel, window, cx| panel.rename(&Rename, window, cx));
+ cx.run_until_parked();
assert!(
panel.read_with(cx, |panel, _| panel.state.edit_state.is_some()),
"Rename should have started"
);
+ panel.update_in(cx, |panel, window, cx| {
+ assert!(
+ panel.filename_editor.read(cx).is_focused(window),
+ "The filename editor must be focused, otherwise deactivating the window blurs nothing"
+ );
+ });
cx.deactivate_window();