Note Clear All tests: Enter is OK and Escape is Cancel (eliets2 review on crates/ui-egui/src/tools/note_clear_all_tests.rs, keyboard)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Hector VillarrealandClaude Opus 5.5 committed 2026-11-07 18:42:50 -06:00
1 parent 0ac80298ba
commit 5d601bbd98
1 file changed
+14
@@ -173,3 +173,17 @@ fn the_alert_shows_its_question_and_its_buttons_answer() {
assert_eq!(steps(h.state()), before + usize::from(left == 0), "{button}: history");
}
}
#[test]
fn enter_is_ok_and_escape_is_cancel() {
for (key, left) in [(egui::Key::Escape, 3), (egui::Key::Enter, 0)] {
let mut h = harness_with_dialogs(app());
let before = steps(h.state());
clear_all(&mut h);
h.key_press(key);
h.run_steps(3);
assert!(alert(h.state()).is_none(), "{key:?} closes the alert");
assert_eq!(notes(h.state()), left, "{key:?}: {left} notes left");
assert_eq!(steps(h.state()), before + usize::from(left == 0), "{key:?}: history");
}
}