fix tests

This commit is contained in:
Conrad Irwin 2023-09-27 17:02:47 -06:00
parent 3573896fe0
commit 6cebcac805

View file

@ -2538,14 +2538,12 @@ mod tests {
set_labeled_items(&pane, ["A", "B", "C*", "D", "E"], cx); set_labeled_items(&pane, ["A", "B", "C*", "D", "E"], cx);
let task = pane pane.update(cx, |pane, cx| {
.update(cx, |pane, cx| { pane.close_inactive_items(&CloseInactiveItems, cx)
pane.close_inactive_items(&CloseInactiveItems, cx) })
}) .unwrap()
.unwrap(); .await
cx.foreground().run_until_parked(); .unwrap();
window.simulate_prompt_answer(2, cx);
task.await.unwrap();
assert_item_labels(&pane, ["C*"], cx); assert_item_labels(&pane, ["C*"], cx);
} }
@ -2566,12 +2564,10 @@ mod tests {
add_labeled_item(&pane, "E", false, cx); add_labeled_item(&pane, "E", false, cx);
assert_item_labels(&pane, ["A^", "B", "C^", "D", "E*"], cx); assert_item_labels(&pane, ["A^", "B", "C^", "D", "E*"], cx);
let task = pane pane.update(cx, |pane, cx| pane.close_clean_items(&CloseCleanItems, cx))
.update(cx, |pane, cx| pane.close_clean_items(&CloseCleanItems, cx)) .unwrap()
.await
.unwrap(); .unwrap();
cx.foreground().run_until_parked();
window.simulate_prompt_answer(2, cx);
task.await.unwrap();
assert_item_labels(&pane, ["A^", "C*^"], cx); assert_item_labels(&pane, ["A^", "C*^"], cx);
} }
@ -2587,14 +2583,12 @@ mod tests {
set_labeled_items(&pane, ["A", "B", "C*", "D", "E"], cx); set_labeled_items(&pane, ["A", "B", "C*", "D", "E"], cx);
let task = pane pane.update(cx, |pane, cx| {
.update(cx, |pane, cx| { pane.close_items_to_the_left(&CloseItemsToTheLeft, cx)
pane.close_items_to_the_left(&CloseItemsToTheLeft, cx) })
}) .unwrap()
.unwrap(); .await
cx.foreground().run_until_parked(); .unwrap();
window.simulate_prompt_answer(2, cx);
task.await.unwrap();
assert_item_labels(&pane, ["C*", "D", "E"], cx); assert_item_labels(&pane, ["C*", "D", "E"], cx);
} }
@ -2610,14 +2604,12 @@ mod tests {
set_labeled_items(&pane, ["A", "B", "C*", "D", "E"], cx); set_labeled_items(&pane, ["A", "B", "C*", "D", "E"], cx);
let task = pane pane.update(cx, |pane, cx| {
.update(cx, |pane, cx| { pane.close_items_to_the_right(&CloseItemsToTheRight, cx)
pane.close_items_to_the_right(&CloseItemsToTheRight, cx) })
}) .unwrap()
.unwrap(); .await
cx.foreground().run_until_parked(); .unwrap();
window.simulate_prompt_answer(2, cx);
task.await.unwrap();
assert_item_labels(&pane, ["A", "B", "C*"], cx); assert_item_labels(&pane, ["A", "B", "C*"], cx);
} }
@ -2636,14 +2628,28 @@ mod tests {
add_labeled_item(&pane, "C", false, cx); add_labeled_item(&pane, "C", false, cx);
assert_item_labels(&pane, ["A", "B", "C*"], cx); assert_item_labels(&pane, ["A", "B", "C*"], cx);
let t = pane pane.update(cx, |pane, cx| {
pane.close_all_items(&CloseAllItems { save_intent: None }, cx)
})
.unwrap()
.await
.unwrap();
assert_item_labels(&pane, [], cx);
add_labeled_item(&pane, "A", true, cx);
add_labeled_item(&pane, "B", true, cx);
add_labeled_item(&pane, "C", true, cx);
assert_item_labels(&pane, ["A^", "B^", "C*^"], cx);
let save = pane
.update(cx, |pane, cx| { .update(cx, |pane, cx| {
pane.close_all_items(&CloseAllItems { save_intent: None }, cx) pane.close_all_items(&CloseAllItems { save_intent: None }, cx)
}) })
.unwrap(); .unwrap();
cx.foreground().run_until_parked(); cx.foreground().run_until_parked();
window.simulate_prompt_answer(2, cx); window.simulate_prompt_answer(2, cx);
t.await.unwrap(); save.await.unwrap();
assert_item_labels(&pane, [], cx); assert_item_labels(&pane, [], cx);
} }