fix: Updated the name of the should_ignore_quit_key to ignore_special_keys_for_textbox_input to give a better idea of what the flag is used for; also added alt keybinding for backspace

This commit is contained in:
2025-03-27 15:21:44 -06:00
parent f25829f3c1
commit cf00d7992e
80 changed files with 584 additions and 435 deletions
@@ -678,7 +678,7 @@ mod tests {
#[test]
fn test_edit_series_path_input_submit() {
let mut app = App::test_default();
app.should_ignore_quit_key = true;
app.ignore_special_keys_for_textbox_input = true;
app.data.sonarr_data.edit_series_modal = Some(EditSeriesModal {
path: "Test Path".into(),
..EditSeriesModal::default()
@@ -695,7 +695,7 @@ mod tests {
)
.handle();
assert!(!app.should_ignore_quit_key);
assert!(!app.ignore_special_keys_for_textbox_input);
assert!(!app
.data
.sonarr_data
@@ -714,7 +714,7 @@ mod tests {
#[test]
fn test_edit_series_tags_input_submit() {
let mut app = App::test_default();
app.should_ignore_quit_key = true;
app.ignore_special_keys_for_textbox_input = true;
app.data.sonarr_data.edit_series_modal = Some(EditSeriesModal {
tags: "Test Tags".into(),
..EditSeriesModal::default()
@@ -731,7 +731,7 @@ mod tests {
)
.handle();
assert!(!app.should_ignore_quit_key);
assert!(!app.ignore_special_keys_for_textbox_input);
assert!(!app
.data
.sonarr_data
@@ -1011,7 +1011,7 @@ mod tests {
if selected_block == ActiveSonarrBlock::EditSeriesPathInput
|| selected_block == ActiveSonarrBlock::EditSeriesTagsInput
{
assert!(app.should_ignore_quit_key);
assert!(app.ignore_special_keys_for_textbox_input);
}
}
@@ -1050,7 +1050,7 @@ mod tests {
.into()
);
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
assert!(!app.should_ignore_quit_key);
assert!(!app.ignore_special_keys_for_textbox_input);
}
#[rstest]
@@ -1086,7 +1086,7 @@ mod tests {
if active_sonarr_block == ActiveSonarrBlock::EditSeriesPathInput
|| active_sonarr_block == ActiveSonarrBlock::EditSeriesTagsInput
{
assert!(!app.should_ignore_quit_key);
assert!(!app.ignore_special_keys_for_textbox_input);
}
}
}
@@ -1112,14 +1112,14 @@ mod tests {
) {
let mut app = App::test_default();
app.data.sonarr_data = create_test_sonarr_data();
app.should_ignore_quit_key = true;
app.ignore_special_keys_for_textbox_input = true;
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
app.push_navigation_stack(ActiveSonarrBlock::EditSeriesPrompt.into());
app.push_navigation_stack(active_sonarr_block.into());
EditSeriesHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
assert!(!app.should_ignore_quit_key);
assert!(!app.ignore_special_keys_for_textbox_input);
assert_eq!(
app.get_current_route(),
ActiveSonarrBlock::EditSeriesPrompt.into()
@@ -1370,11 +1370,11 @@ mod tests {
}
#[rstest]
fn test_edit_series_handler_ignore_alt_navigation(
#[values(true, false)] should_ignore_quit_key: bool,
fn test_edit_series_handler_ignore_special_keys(
#[values(true, false)] ignore_special_keys_for_textbox_input: bool,
) {
let mut app = App::test_default();
app.should_ignore_quit_key = should_ignore_quit_key;
app.ignore_special_keys_for_textbox_input = ignore_special_keys_for_textbox_input;
let handler = EditSeriesHandler::new(
DEFAULT_KEYBINDINGS.esc.key,
&mut app,
@@ -1382,7 +1382,10 @@ mod tests {
None,
);
assert_eq!(handler.ignore_alt_navigation(), should_ignore_quit_key);
assert_eq!(
handler.ignore_special_keys(),
ignore_special_keys_for_textbox_input
);
}
#[test]