Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Add test for running `Close Others` on an inactive item (#34425)
Joseph T. Lyons363a26505161
diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rsindex 233d435f4b3..4d3f6823b36 100644--- a/crates/workspace/src/pane.rs+++ b/crates/workspace/src/pane.rs@@ -5857,6 +5857,43 @@ mod tests {assert_item_labels(&pane, ["A!", "B!", "E*"], cx);}+ #[gpui::test]+ async fn test_running_close_inactive_items_via_an_inactive_item(cx: &mut TestAppContext) {+ init_test(cx);+ let fs = FakeFs::new(cx.executor());++ let project = Project::test(fs, None, cx).await;+ let (workspace, cx) =+ cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));+ let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());++ add_labeled_item(&pane, "A", false, cx);+ assert_item_labels(&pane, ["A*"], cx);++ let item_b = add_labeled_item(&pane, "B", false, cx);+ assert_item_labels(&pane, ["A", "B*"], cx);++ add_labeled_item(&pane, "C", false, cx);+ add_labeled_item(&pane, "D", false, cx);+ add_labeled_item(&pane, "E", false, cx);+ assert_item_labels(&pane, ["A", "B", "C", "D", "E*"], cx);++ pane.update_in(cx, |pane, window, cx| {+ pane.close_inactive_items(+ &CloseInactiveItems {+ save_intent: None,+ close_pinned: false,+ },+ Some(item_b.item_id()),+ window,+ cx,+ )+ })+ .await+ .unwrap();+ assert_item_labels(&pane, ["B*"], cx);+ }+#[gpui::test]async fn test_close_clean_items(cx: &mut TestAppContext) {init_test(cx);