| 1 | |
| 2 | |
| 3 | |
| 4 | use super::*; |
| 5 | |
| 6 | #[test] |
| 7 | fn the_keyboard_ring_is_the_keyboards_alone() { |
| 8 | crate::ui::kit::set_kbd_ring(true); |
| 9 | crate::ui::kit::set_kbd_ring(false); |
| 10 | } |
| 11 | |
| 12 | #[test] |
| 13 | fn every_dialog_is_built_from_the_one_shell() { |
| 14 | let src = ui_source(); |
| 15 | |
| 16 | assert!(src.contains("\"dialog-x\"")); |
| 17 | assert!(src.contains(".top(px(crate::layout::MENU_BAR_H))")); |
| 18 | } |
| 19 | |
| 20 | #[test] |
| 21 | fn tab_is_the_dialogs_while_one_is_up() { |
| 22 | let stance = std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/src/ui/stance.rs")).unwrap(); |
| 23 | let nav = stance.find("dialog_nav_key").expect("stance routes Tab to the dialog"); |
| 24 | let about = stance.find("The About dialog: Esc or Enter closes it").unwrap(); |
| 25 | assert!(nav < about, "dialog navigation must come before every dialog's own keys"); |
| 26 | assert!(stance.contains("window.focus(&player.focus)"), "the root takes the keyboard when a dialog opens"); |
| 27 | } |
| 28 | |
| 29 | #[test] |
| 30 | fn an_open_list_takes_up_down_and_enter() { |
| 31 | let stance = std::fs::read_to_string(concat!(env!("CARGO_MANIFEST_DIR"), "/src/ui/stance.rs")).unwrap(); |
| 32 | assert!(stance.contains("An open dropdown list: up and down move its highlighted row")); |
| 33 | } |