1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-License-Identifier: MIT OR Apache-2.0
//! 2026-09-26: Tests that keys reach the Help section through `App::on_key`, the real entry point.
//!
//! `HelpState`'s own tests call `HelpState::on_key` directly, so they cannot
//! see whether `App` routes a key there.
//!
//! Owner: server tui.
//! Invariants: none beyond the types.
use super::tests::{app, press, tap};
use super::*;
use crossterm::event::KeyCode;
/// 2026-09-26: The report title accepts typing through `App::on_key`.
///
/// `in_input()` is true while the title is being edited, so this checks that
/// `on_input_key` hands the key to `HelpState` and not to the `?` modal.
#[test]
fn typing_a_report_title_reaches_the_composer_and_does_not_look_frozen() {
let mut a = app();
a.jump(Section::Help);
a.help.sub = crate::tui::help_state::HelpSub::Report;
// 2026-09-26: Enter on the Title row starts editing.
tap(&mut a, KeyCode::Enter);
assert!(
a.help.is_editing(),
"Enter on Title must start editing, else the field can never be filled"
);
for c in "gpu oom".chars() {
press(&mut a, c);
}
assert_eq!(
a.help.title, "gpu oom",
"every typed character must reach the title buffer"
);
tap(&mut a, KeyCode::Backspace);
assert_eq!(a.help.title, "gpu oo");
// 2026-09-26: Esc leaves edit mode and keeps the draft title, unlike a filter box's Esc.
tap(&mut a, KeyCode::Esc);
assert!(!a.help.is_editing());
assert_eq!(a.help.title, "gpu oo");
}