feat: discard playback selection with Escape
This commit is contained in:
+20
-4
@@ -3634,7 +3634,7 @@ fn forward_navigation_skips_unsubscribed_views() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn escape_and_minus_restore_view_history_without_consuming_modal_escape() {
|
||||
fn minus_restores_view_history_without_consuming_modal_escape() {
|
||||
let mut app = app(&["tubular"]);
|
||||
app.apply_config(config::Config {
|
||||
categories: [("Category".into(), Vec::new())].into(),
|
||||
@@ -3675,7 +3675,7 @@ fn escape_and_minus_restore_view_history_without_consuming_modal_escape() {
|
||||
app.views[app.view_index].source,
|
||||
ViewSource::Channel("beta".into())
|
||||
);
|
||||
app.key(KeyEvent::new(KeyCode::Esc, KeyModifiers::NONE));
|
||||
app.key(KeyEvent::new(KeyCode::Char('-'), KeyModifiers::NONE));
|
||||
assert_eq!(
|
||||
app.views[app.view_index].source,
|
||||
ViewSource::Channel("alpha".into())
|
||||
@@ -3691,7 +3691,7 @@ fn escape_and_minus_restore_view_history_without_consuming_modal_escape() {
|
||||
app.views[app.view_index].source,
|
||||
ViewSource::Category("Category".into())
|
||||
);
|
||||
app.key(KeyEvent::new(KeyCode::Esc, KeyModifiers::NONE));
|
||||
app.key(KeyEvent::new(KeyCode::Char('-'), KeyModifiers::NONE));
|
||||
assert_eq!(app.views[app.view_index].source, ViewSource::Search);
|
||||
app.key(KeyEvent::new(KeyCode::Char('-'), KeyModifiers::NONE));
|
||||
assert_eq!(app.views[app.view_index].source, ViewSource::Search);
|
||||
@@ -3727,7 +3727,7 @@ fn back_history_uses_source_identity_after_config_reorders_or_removes_views() {
|
||||
channels: [("@Alpha".into(), "alpha".into())].into(),
|
||||
..Default::default()
|
||||
});
|
||||
app.key(KeyEvent::new(KeyCode::Esc, KeyModifiers::NONE));
|
||||
app.key(KeyEvent::new(KeyCode::Char('-'), KeyModifiers::NONE));
|
||||
assert_eq!(app.views[app.view_index].source, ViewSource::Search);
|
||||
assert!(app.job.is_none());
|
||||
}
|
||||
@@ -6059,3 +6059,19 @@ fn search_without_a_handle_can_tag_a_registered_channel() {
|
||||
);
|
||||
std::fs::remove_file(path).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn escape_discards_checks_without_consuming_view_history() {
|
||||
let mut app = app(&["tubular"]);
|
||||
app.views[0].loaded = true;
|
||||
app.views[1].loaded = true;
|
||||
app.switch_view(1);
|
||||
app.views[1].checked.insert("jNQXAC9IVRw".into());
|
||||
app.key(KeyEvent::new(KeyCode::Esc, KeyModifiers::NONE));
|
||||
assert!(app.views[1].checked.is_empty());
|
||||
assert_eq!(app.view_index, 1);
|
||||
app.key(KeyEvent::new(KeyCode::Esc, KeyModifiers::NONE));
|
||||
assert_eq!(app.view_index, 1);
|
||||
app.key(KeyEvent::new(KeyCode::Char('-'), KeyModifiers::NONE));
|
||||
assert_eq!(app.view_index, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user