Add test for running Close Others on an inactive item (#34425)

Adds a test for the changes added in:
https://github.com/zed-industries/zed/pull/34355

Release Notes:

- N/A
This commit is contained in:
Joseph T. Lyons 2025-07-14 16:24:05 -04:00 committed by GitHub
parent 37e73e3277
commit 363a265051
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);