test(tui): attention filter toggle round-trip restores full view #202
1 changed files with 48 additions and 0 deletions
|
|
@ -1209,6 +1209,54 @@ mod tests {
|
|||
assert_eq!(filtered[1].id, "pane-blocked");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn attention_filter_toggle_roundtrip_restores_full_view() {
|
||||
// attention filter ON then OFF should restore exactly the same view.
|
||||
let snap = GlasspaneSnapshot::new(
|
||||
"osa",
|
||||
"2026-06-25T12:00:00Z",
|
||||
vec![
|
||||
colibri_glasspane::Pane {
|
||||
id: "pane-ok".into(),
|
||||
agent: "zot".into(),
|
||||
state: AgentState::Working,
|
||||
session_id: Some("s1".into()),
|
||||
last_event_at: None,
|
||||
cwd: None,
|
||||
stalled: false,
|
||||
},
|
||||
colibri_glasspane::Pane {
|
||||
id: "pane-err".into(),
|
||||
agent: "zot".into(),
|
||||
state: AgentState::Error,
|
||||
session_id: Some("s1".into()),
|
||||
last_event_at: None,
|
||||
cwd: None,
|
||||
stalled: false,
|
||||
},
|
||||
],
|
||||
);
|
||||
let mut app = App::new(PathBuf::from("/tmp/nonexistent.sock"));
|
||||
app.snapshot = Some(snap);
|
||||
app.rebuild_session_list();
|
||||
|
||||
let before: Vec<String> = app.filtered_panes().iter().map(|p| p.id.clone()).collect();
|
||||
|
||||
// Toggle ON
|
||||
app.attention_only = true;
|
||||
let filtered = app.filtered_panes();
|
||||
assert_eq!(filtered.len(), 1);
|
||||
assert_eq!(filtered[0].id, "pane-err");
|
||||
|
||||
// Toggle OFF — must restore the full view exactly
|
||||
app.attention_only = false;
|
||||
let after: Vec<String> = app.filtered_panes().iter().map(|p| p.id.clone()).collect();
|
||||
assert_eq!(
|
||||
before, after,
|
||||
"toggling attention filter off must restore the full pane list"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn attention_bar_does_not_render_when_all_healthy() {
|
||||
let snap = GlasspaneSnapshot::new(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue