diff options
author | Piotr Wach <pwach@bloomberg.net> | 2024-01-20 10:44:10 +0000 |
---|---|---|
committer | Piotr Wach <pwach@bloomberg.net> | 2024-01-20 10:44:10 +0000 |
commit | dbab511ff68d8cc7d8e4906db3c2472dd8305b77 (patch) | |
tree | 1ebcdceb354e7c0070c3d2f890cfceeaafe34e22 | |
parent | 322eeb1aa07dacdc82e147bae64f8bfd4d758e1d (diff) |
Tests for shwing/hiding additional columns
-rw-r--r-- | src/interactive/app/tests/journeys_readonly.rs | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/interactive/app/tests/journeys_readonly.rs b/src/interactive/app/tests/journeys_readonly.rs index f307294..c89c9c4 100644 --- a/src/interactive/app/tests/journeys_readonly.rs +++ b/src/interactive/app/tests/journeys_readonly.rs @@ -1,9 +1,11 @@ use anyhow::Result; -use crosstermion::crossterm::event::KeyCode; +use crosstermion::crossterm::event::{KeyCode, KeyEvent, KeyModifiers}; +use crosstermion::input::Event; use pretty_assertions::assert_eq; use std::ffi::OsString; -use crate::interactive::app::tests::utils::into_codes; +use crate::interactive::app::tests::utils::{into_codes, into_events}; +use crate::interactive::widgets::Column; use crate::interactive::{ app::tests::{ utils::{ @@ -129,6 +131,33 @@ fn simple_user_journey_read_only() -> Result<()> { ); } + // Columns + { + // hit the C key shows the entry count column + app.process_events(&mut terminal, into_events([ + Event::Key(KeyEvent::new(KeyCode::Char('C'), KeyModifiers::NONE)), + ]))?; + assert!(app.state.show_columns.contains(&Column::Count)); + + // when hitting the C key again hides the entry count column + app.process_events(&mut terminal, into_events([ + Event::Key(KeyEvent::new(KeyCode::Char('C'), KeyModifiers::NONE)), + ]))?; + assert!(!app.state.show_columns.contains(&Column::Count)); + + // hit the M key shows the entry count column + app.process_events(&mut terminal, into_events([ + Event::Key(KeyEvent::new(KeyCode::Char('M'), KeyModifiers::NONE)), + ]))?; + assert!(app.state.show_columns.contains(&Column::MTime)); + + // when hitting the M key again hides the entry count column + app.process_events(&mut terminal, into_events([ + Event::Key(KeyEvent::new(KeyCode::Char('M'), KeyModifiers::NONE)), + ]))?; + assert!(!app.state.show_columns.contains(&Column::MTime)); + } + // Entry-Navigation { // when hitting the j key |