forge
Explore
Log in

Don't you dare go Hollow

edith

Clone
★ 0

0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits

dlg.rs33 lines, 1.3 KiBHistoryRawDownload
1//! The dialogs' keyboard and shell: Tab walks a dialog's controls, the root is focused when one
2//! opens, an open list answers the arrows, every dialog is one shell.
3
4use super::*;
5
6#[test]
7fn 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]
13fn every_dialog_is_built_from_the_one_shell() {
14 let src = ui_source();
15 // The shell carries the close X and sits below the menu bar.
16 assert!(src.contains("\"dialog-x\""));
17 assert!(src.contains(".top(px(crate::layout::MENU_BAR_H))"));
18}
19
20#[test]
21fn 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]
30fn 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}