refactor: Renamed KeyEventHandler::with to KeyEventHandler::new to keep with Rust best practices and conventions
This commit is contained in:
@@ -28,7 +28,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Blocklist.into());
|
||||
app.data.sonarr_data.blocklist.set_items(blocklist_vec());
|
||||
|
||||
BlocklistHandler::with(DELETE_KEY, &mut app, ActiveSonarrBlock::Blocklist, None).handle();
|
||||
BlocklistHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::Blocklist, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -43,7 +43,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Blocklist.into());
|
||||
app.data.sonarr_data.blocklist.set_items(blocklist_vec());
|
||||
|
||||
BlocklistHandler::with(DELETE_KEY, &mut app, ActiveSonarrBlock::Blocklist, None).handle();
|
||||
BlocklistHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::Blocklist, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Blocklist.into());
|
||||
}
|
||||
@@ -62,7 +62,7 @@ mod tests {
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(2);
|
||||
|
||||
BlocklistHandler::with(
|
||||
BlocklistHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Blocklist,
|
||||
@@ -84,7 +84,7 @@ mod tests {
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(2);
|
||||
|
||||
BlocklistHandler::with(
|
||||
BlocklistHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Blocklist,
|
||||
@@ -111,11 +111,11 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Blocklist.into());
|
||||
|
||||
BlocklistHandler::with(key, &mut app, active_sonarr_block, None).handle();
|
||||
BlocklistHandler::new(key, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
|
||||
BlocklistHandler::with(key, &mut app, active_sonarr_block, None).handle();
|
||||
BlocklistHandler::new(key, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
@@ -137,7 +137,7 @@ mod tests {
|
||||
app.data.sonarr_data.blocklist.set_items(blocklist_vec());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Blocklist.into());
|
||||
|
||||
BlocklistHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Blocklist, None).handle();
|
||||
BlocklistHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Blocklist, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -152,7 +152,7 @@ mod tests {
|
||||
app.data.sonarr_data.blocklist.set_items(blocklist_vec());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Blocklist.into());
|
||||
|
||||
BlocklistHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Blocklist, None).handle();
|
||||
BlocklistHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Blocklist, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Blocklist.into());
|
||||
}
|
||||
@@ -179,7 +179,7 @@ mod tests {
|
||||
app.push_navigation_stack(base_route.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
BlocklistHandler::with(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
BlocklistHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
@@ -202,7 +202,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Blocklist.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
BlocklistHandler::with(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
BlocklistHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
@@ -236,7 +236,7 @@ mod tests {
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
app.data.sonarr_data.prompt_confirm = true;
|
||||
|
||||
BlocklistHandler::with(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
BlocklistHandler::new(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), base_block.into());
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
@@ -248,7 +248,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Blocklist.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::BlocklistItemDetails.into());
|
||||
|
||||
BlocklistHandler::with(
|
||||
BlocklistHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::BlocklistItemDetails,
|
||||
@@ -267,7 +267,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Blocklist.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Blocklist.into());
|
||||
|
||||
BlocklistHandler::with(ESC_KEY, &mut app, ActiveSonarrBlock::Blocklist, None).handle();
|
||||
BlocklistHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::Blocklist, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Blocklist.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
@@ -288,7 +288,7 @@ mod tests {
|
||||
app.data.sonarr_data.blocklist.set_items(blocklist_vec());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Blocklist.into());
|
||||
|
||||
BlocklistHandler::with(
|
||||
BlocklistHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Blocklist,
|
||||
@@ -307,7 +307,7 @@ mod tests {
|
||||
app.data.sonarr_data.blocklist.set_items(blocklist_vec());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Blocklist.into());
|
||||
|
||||
BlocklistHandler::with(
|
||||
BlocklistHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Blocklist,
|
||||
@@ -325,7 +325,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Blocklist.into());
|
||||
app.data.sonarr_data.blocklist.set_items(blocklist_vec());
|
||||
|
||||
BlocklistHandler::with(
|
||||
BlocklistHandler::new(
|
||||
DEFAULT_KEYBINDINGS.clear.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Blocklist,
|
||||
@@ -346,7 +346,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Blocklist.into());
|
||||
app.data.sonarr_data.blocklist.set_items(blocklist_vec());
|
||||
|
||||
BlocklistHandler::with(
|
||||
BlocklistHandler::new(
|
||||
DEFAULT_KEYBINDINGS.clear.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Blocklist,
|
||||
@@ -378,7 +378,7 @@ mod tests {
|
||||
app.push_navigation_stack(base_route.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
BlocklistHandler::with(
|
||||
BlocklistHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
prompt_block,
|
||||
@@ -518,7 +518,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.data.sonarr_data.blocklist.set_items(blocklist_vec());
|
||||
|
||||
let blocklist_item_id = BlocklistHandler::with(
|
||||
let blocklist_item_id = BlocklistHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Blocklist,
|
||||
@@ -535,7 +535,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Blocklist.into());
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = BlocklistHandler::with(
|
||||
let handler = BlocklistHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Blocklist,
|
||||
@@ -551,7 +551,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Blocklist.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = BlocklistHandler::with(
|
||||
let handler = BlocklistHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Blocklist,
|
||||
@@ -572,7 +572,7 @@ mod tests {
|
||||
.blocklist
|
||||
.set_items(vec![BlocklistItem::default()]);
|
||||
|
||||
let handler = BlocklistHandler::with(
|
||||
let handler = BlocklistHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Blocklist,
|
||||
|
||||
@@ -51,7 +51,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for BlocklistHandler<'a,
|
||||
BLOCKLIST_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -29,7 +29,7 @@ mod tests {
|
||||
.downloads
|
||||
.set_items(vec![DownloadRecord::default()]);
|
||||
|
||||
DownloadsHandler::with(DELETE_KEY, &mut app, ActiveSonarrBlock::Downloads, None).handle();
|
||||
DownloadsHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::Downloads, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -48,7 +48,7 @@ mod tests {
|
||||
.downloads
|
||||
.set_items(vec![DownloadRecord::default()]);
|
||||
|
||||
DownloadsHandler::with(DELETE_KEY, &mut app, ActiveSonarrBlock::Downloads, None).handle();
|
||||
DownloadsHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::Downloads, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Downloads.into());
|
||||
}
|
||||
@@ -67,7 +67,7 @@ mod tests {
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(1);
|
||||
|
||||
DownloadsHandler::with(
|
||||
DownloadsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Downloads,
|
||||
@@ -89,7 +89,7 @@ mod tests {
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(1);
|
||||
|
||||
DownloadsHandler::with(
|
||||
DownloadsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Downloads,
|
||||
@@ -116,11 +116,11 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Downloads.into());
|
||||
|
||||
DownloadsHandler::with(key, &mut app, active_sonarr_block, None).handle();
|
||||
DownloadsHandler::new(key, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
|
||||
DownloadsHandler::with(key, &mut app, active_sonarr_block, None).handle();
|
||||
DownloadsHandler::new(key, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
@@ -162,7 +162,7 @@ mod tests {
|
||||
app.push_navigation_stack(base_route.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
DownloadsHandler::with(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
DownloadsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
@@ -188,7 +188,7 @@ mod tests {
|
||||
app.push_navigation_stack(base_route.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
DownloadsHandler::with(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
DownloadsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.data.sonarr_data.prompt_confirm_action, None);
|
||||
@@ -216,7 +216,7 @@ mod tests {
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
app.data.sonarr_data.prompt_confirm = true;
|
||||
|
||||
DownloadsHandler::with(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
DownloadsHandler::new(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), base_block.into());
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
@@ -230,7 +230,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Downloads.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Downloads.into());
|
||||
|
||||
DownloadsHandler::with(ESC_KEY, &mut app, ActiveSonarrBlock::Downloads, None).handle();
|
||||
DownloadsHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::Downloads, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Downloads.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
@@ -255,7 +255,7 @@ mod tests {
|
||||
.downloads
|
||||
.set_items(vec![DownloadRecord::default()]);
|
||||
|
||||
DownloadsHandler::with(
|
||||
DownloadsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Downloads,
|
||||
@@ -280,7 +280,7 @@ mod tests {
|
||||
.downloads
|
||||
.set_items(vec![DownloadRecord::default()]);
|
||||
|
||||
DownloadsHandler::with(
|
||||
DownloadsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Downloads,
|
||||
@@ -301,7 +301,7 @@ mod tests {
|
||||
.set_items(vec![DownloadRecord::default()]);
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Downloads.into());
|
||||
|
||||
DownloadsHandler::with(
|
||||
DownloadsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Downloads,
|
||||
@@ -324,7 +324,7 @@ mod tests {
|
||||
.downloads
|
||||
.set_items(vec![DownloadRecord::default()]);
|
||||
|
||||
DownloadsHandler::with(
|
||||
DownloadsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Downloads,
|
||||
@@ -361,7 +361,7 @@ mod tests {
|
||||
app.push_navigation_stack(base_route.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
DownloadsHandler::with(
|
||||
DownloadsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
prompt_block,
|
||||
@@ -398,7 +398,7 @@ mod tests {
|
||||
.downloads
|
||||
.set_items(vec![download_record()]);
|
||||
|
||||
let download_id = DownloadsHandler::with(
|
||||
let download_id = DownloadsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Downloads,
|
||||
@@ -415,7 +415,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Downloads.into());
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = DownloadsHandler::with(
|
||||
let handler = DownloadsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Downloads,
|
||||
@@ -431,7 +431,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Downloads.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = DownloadsHandler::with(
|
||||
let handler = DownloadsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Downloads,
|
||||
@@ -452,7 +452,7 @@ mod tests {
|
||||
.sonarr_data
|
||||
.downloads
|
||||
.set_items(vec![DownloadRecord::default()]);
|
||||
let handler = DownloadsHandler::with(
|
||||
let handler = DownloadsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Downloads,
|
||||
|
||||
@@ -47,7 +47,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for DownloadsHandler<'a,
|
||||
DOWNLOADS_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -28,7 +28,7 @@ mod tests {
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(3);
|
||||
|
||||
HistoryHandler::with(
|
||||
HistoryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::History,
|
||||
@@ -50,7 +50,7 @@ mod tests {
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(3);
|
||||
|
||||
HistoryHandler::with(
|
||||
HistoryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::History,
|
||||
@@ -82,7 +82,7 @@ mod tests {
|
||||
app.data.sonarr_data.history.set_items(history_vec());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::History.into());
|
||||
|
||||
HistoryHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::History, None).handle();
|
||||
HistoryHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::History, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -97,7 +97,7 @@ mod tests {
|
||||
app.data.sonarr_data.history.set_items(history_vec());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::History.into());
|
||||
|
||||
HistoryHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::History, None).handle();
|
||||
HistoryHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::History, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::History.into());
|
||||
}
|
||||
@@ -124,7 +124,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::History.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::HistoryItemDetails.into());
|
||||
|
||||
HistoryHandler::with(
|
||||
HistoryHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::HistoryItemDetails,
|
||||
@@ -149,7 +149,7 @@ mod tests {
|
||||
.history
|
||||
.set_items(vec![SonarrHistoryItem::default()]);
|
||||
|
||||
HistoryHandler::with(ESC_KEY, &mut app, ActiveSonarrBlock::History, None).handle();
|
||||
HistoryHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::History, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::History.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
@@ -167,7 +167,7 @@ mod tests {
|
||||
app.data.sonarr_data.history.set_items(history_vec());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::History.into());
|
||||
|
||||
HistoryHandler::with(
|
||||
HistoryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::History,
|
||||
@@ -186,7 +186,7 @@ mod tests {
|
||||
app.data.sonarr_data.history.set_items(history_vec());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::History.into());
|
||||
|
||||
HistoryHandler::with(
|
||||
HistoryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::History,
|
||||
@@ -312,7 +312,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::History.into());
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = HistoryHandler::with(
|
||||
let handler = HistoryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::History,
|
||||
@@ -328,7 +328,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::History.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = HistoryHandler::with(
|
||||
let handler = HistoryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::History,
|
||||
@@ -349,7 +349,7 @@ mod tests {
|
||||
.history
|
||||
.set_items(vec![SonarrHistoryItem::default()]);
|
||||
|
||||
let handler = HistoryHandler::with(
|
||||
let handler = HistoryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::History,
|
||||
|
||||
@@ -52,7 +52,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for HistoryHandler<'a, '
|
||||
HISTORY_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -78,7 +78,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for EditIndexerHandler<'
|
||||
EDIT_INDEXER_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -29,7 +29,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.data.sonarr_data.edit_indexer_modal = Some(EditIndexerModal::default());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPriorityInput,
|
||||
@@ -60,7 +60,7 @@ mod tests {
|
||||
0
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
Key::Up,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPriorityInput,
|
||||
@@ -79,7 +79,7 @@ mod tests {
|
||||
1
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPriorityInput,
|
||||
@@ -108,7 +108,7 @@ mod tests {
|
||||
BlockSelectionState::new(EDIT_INDEXER_TORRENT_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.down();
|
||||
|
||||
EditIndexerHandler::with(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
EditIndexerHandler::new(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
|
||||
if key == Key::Up {
|
||||
assert_eq!(
|
||||
@@ -135,7 +135,7 @@ mod tests {
|
||||
BlockSelectionState::new(EDIT_INDEXER_TORRENT_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.down();
|
||||
|
||||
EditIndexerHandler::with(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
EditIndexerHandler::new(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.selected_block.get_active_block(),
|
||||
@@ -162,7 +162,7 @@ mod tests {
|
||||
..EditIndexerModal::default()
|
||||
});
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerNameInput,
|
||||
@@ -183,7 +183,7 @@ mod tests {
|
||||
4
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerNameInput,
|
||||
@@ -214,7 +214,7 @@ mod tests {
|
||||
..EditIndexerModal::default()
|
||||
});
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerUrlInput,
|
||||
@@ -235,7 +235,7 @@ mod tests {
|
||||
4
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerUrlInput,
|
||||
@@ -266,7 +266,7 @@ mod tests {
|
||||
..EditIndexerModal::default()
|
||||
});
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerApiKeyInput,
|
||||
@@ -287,7 +287,7 @@ mod tests {
|
||||
4
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerApiKeyInput,
|
||||
@@ -318,7 +318,7 @@ mod tests {
|
||||
..EditIndexerModal::default()
|
||||
});
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerSeedRatioInput,
|
||||
@@ -339,7 +339,7 @@ mod tests {
|
||||
4
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerSeedRatioInput,
|
||||
@@ -370,7 +370,7 @@ mod tests {
|
||||
..EditIndexerModal::default()
|
||||
});
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerTagsInput,
|
||||
@@ -391,7 +391,7 @@ mod tests {
|
||||
4
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerTagsInput,
|
||||
@@ -436,11 +436,11 @@ mod tests {
|
||||
BlockSelectionState::new(EDIT_INDEXER_TORRENT_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.y = EDIT_INDEXER_TORRENT_SELECTION_BLOCKS.len() - 1;
|
||||
|
||||
EditIndexerHandler::with(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
EditIndexerHandler::new(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
|
||||
EditIndexerHandler::with(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
EditIndexerHandler::new(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
@@ -483,14 +483,14 @@ mod tests {
|
||||
left_block
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
EditIndexerHandler::new(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.selected_block.get_active_block(),
|
||||
right_block
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
EditIndexerHandler::new(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.selected_block.get_active_block(),
|
||||
@@ -536,14 +536,14 @@ mod tests {
|
||||
left_block
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
EditIndexerHandler::new(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.selected_block.get_active_block(),
|
||||
right_block
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
EditIndexerHandler::new(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.selected_block.get_active_block(),
|
||||
@@ -567,14 +567,14 @@ mod tests {
|
||||
ActiveSonarrBlock::EditIndexerPriorityInput
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
EditIndexerHandler::new(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.selected_block.get_active_block(),
|
||||
ActiveSonarrBlock::EditIndexerConfirmPrompt
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
EditIndexerHandler::new(key, &mut app, ActiveSonarrBlock::EditIndexerPrompt, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.selected_block.get_active_block(),
|
||||
@@ -592,7 +592,7 @@ mod tests {
|
||||
..EditIndexerModal::default()
|
||||
});
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerNameInput,
|
||||
@@ -613,7 +613,7 @@ mod tests {
|
||||
1
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerNameInput,
|
||||
@@ -644,7 +644,7 @@ mod tests {
|
||||
..EditIndexerModal::default()
|
||||
});
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerUrlInput,
|
||||
@@ -665,7 +665,7 @@ mod tests {
|
||||
1
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerUrlInput,
|
||||
@@ -696,7 +696,7 @@ mod tests {
|
||||
..EditIndexerModal::default()
|
||||
});
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerApiKeyInput,
|
||||
@@ -717,7 +717,7 @@ mod tests {
|
||||
1
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerApiKeyInput,
|
||||
@@ -748,7 +748,7 @@ mod tests {
|
||||
..EditIndexerModal::default()
|
||||
});
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerSeedRatioInput,
|
||||
@@ -769,7 +769,7 @@ mod tests {
|
||||
1
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerSeedRatioInput,
|
||||
@@ -800,7 +800,7 @@ mod tests {
|
||||
..EditIndexerModal::default()
|
||||
});
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerTagsInput,
|
||||
@@ -821,7 +821,7 @@ mod tests {
|
||||
1
|
||||
);
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerTagsInput,
|
||||
@@ -873,7 +873,7 @@ mod tests {
|
||||
.set_index(0, EDIT_INDEXER_TORRENT_SELECTION_BLOCKS.len() - 1);
|
||||
app.data.sonarr_data.edit_indexer_modal = Some(EditIndexerModal::default());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -927,7 +927,7 @@ mod tests {
|
||||
};
|
||||
app.data.sonarr_data.prompt_confirm = true;
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -953,7 +953,7 @@ mod tests {
|
||||
app.data.sonarr_data.edit_indexer_modal = Some(EditIndexerModal::default());
|
||||
app.data.sonarr_data.prompt_confirm = true;
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -993,7 +993,7 @@ mod tests {
|
||||
.selected_block
|
||||
.set_index(starting_x, starting_y);
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -1015,7 +1015,7 @@ mod tests {
|
||||
BlockSelectionState::new(EDIT_INDEXER_TORRENT_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.set_index(0, 4);
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -1040,7 +1040,7 @@ mod tests {
|
||||
app.data.sonarr_data.selected_block.set_index(0, 1);
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditIndexerPrompt.into());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -1061,7 +1061,7 @@ mod tests {
|
||||
.enable_rss
|
||||
.unwrap());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -1093,7 +1093,7 @@ mod tests {
|
||||
app.data.sonarr_data.selected_block.set_index(0, 2);
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditIndexerPrompt.into());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -1114,7 +1114,7 @@ mod tests {
|
||||
.enable_automatic_search
|
||||
.unwrap());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -1146,7 +1146,7 @@ mod tests {
|
||||
app.data.sonarr_data.selected_block.set_index(0, 3);
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditIndexerPrompt.into());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -1167,7 +1167,7 @@ mod tests {
|
||||
.enable_interactive_search
|
||||
.unwrap());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -1201,7 +1201,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditIndexerPrompt.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditIndexerNameInput.into());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerNameInput,
|
||||
@@ -1237,7 +1237,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditIndexerPrompt.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditIndexerUrlInput.into());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerUrlInput,
|
||||
@@ -1273,7 +1273,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditIndexerPrompt.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditIndexerApiKeyInput.into());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerApiKeyInput,
|
||||
@@ -1309,7 +1309,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditIndexerPrompt.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditIndexerSeedRatioInput.into());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerSeedRatioInput,
|
||||
@@ -1345,7 +1345,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditIndexerPrompt.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditIndexerTagsInput.into());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerTagsInput,
|
||||
@@ -1388,7 +1388,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditIndexerPrompt.into());
|
||||
app.data.sonarr_data.edit_indexer_modal = Some(EditIndexerModal::default());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -1419,7 +1419,7 @@ mod tests {
|
||||
app.data.sonarr_data.edit_indexer_modal = Some(EditIndexerModal::default());
|
||||
app.should_ignore_quit_key = true;
|
||||
|
||||
EditIndexerHandler::with(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
EditIndexerHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert!(!app.should_ignore_quit_key);
|
||||
@@ -1449,7 +1449,7 @@ mod tests {
|
||||
..EditIndexerModal::default()
|
||||
});
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.backspace.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerNameInput,
|
||||
@@ -1479,7 +1479,7 @@ mod tests {
|
||||
..EditIndexerModal::default()
|
||||
});
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.backspace.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerUrlInput,
|
||||
@@ -1509,7 +1509,7 @@ mod tests {
|
||||
..EditIndexerModal::default()
|
||||
});
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.backspace.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerApiKeyInput,
|
||||
@@ -1539,7 +1539,7 @@ mod tests {
|
||||
..EditIndexerModal::default()
|
||||
});
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.backspace.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerSeedRatioInput,
|
||||
@@ -1569,7 +1569,7 @@ mod tests {
|
||||
..EditIndexerModal::default()
|
||||
});
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.backspace.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerTagsInput,
|
||||
@@ -1596,7 +1596,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.data.sonarr_data.edit_indexer_modal = Some(EditIndexerModal::default());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
Key::Char('h'),
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerNameInput,
|
||||
@@ -1623,7 +1623,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.data.sonarr_data.edit_indexer_modal = Some(EditIndexerModal::default());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
Key::Char('h'),
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerUrlInput,
|
||||
@@ -1650,7 +1650,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.data.sonarr_data.edit_indexer_modal = Some(EditIndexerModal::default());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
Key::Char('h'),
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerApiKeyInput,
|
||||
@@ -1677,7 +1677,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.data.sonarr_data.edit_indexer_modal = Some(EditIndexerModal::default());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
Key::Char('h'),
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerSeedRatioInput,
|
||||
@@ -1704,7 +1704,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.data.sonarr_data.edit_indexer_modal = Some(EditIndexerModal::default());
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
Key::Char('h'),
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerTagsInput,
|
||||
@@ -1764,7 +1764,7 @@ mod tests {
|
||||
..EditIndexerParams::default()
|
||||
};
|
||||
|
||||
EditIndexerHandler::with(
|
||||
EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -1823,7 +1823,7 @@ mod tests {
|
||||
..EditIndexerParams::default()
|
||||
};
|
||||
|
||||
let params = EditIndexerHandler::with(
|
||||
let params = EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -1841,7 +1841,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = EditIndexerHandler::with(
|
||||
let handler = EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -1857,7 +1857,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = EditIndexerHandler::with(
|
||||
let handler = EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
@@ -1874,7 +1874,7 @@ mod tests {
|
||||
app.is_loading = false;
|
||||
app.data.sonarr_data.edit_indexer_modal = Some(EditIndexerModal::default());
|
||||
|
||||
let handler = EditIndexerHandler::with(
|
||||
let handler = EditIndexerHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditIndexerPrompt,
|
||||
|
||||
@@ -42,7 +42,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for IndexerSettingsHandl
|
||||
INDEXER_SETTINGS_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -30,7 +30,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.data.sonarr_data.indexer_settings = Some(IndexerSettings::default());
|
||||
|
||||
IndexerSettingsHandler::with($key, &mut app, $block, None).handle();
|
||||
IndexerSettingsHandler::new($key, &mut app, $block, None).handle();
|
||||
|
||||
if $key == Key::Up {
|
||||
assert_eq!(
|
||||
@@ -67,7 +67,7 @@ mod tests {
|
||||
0
|
||||
);
|
||||
|
||||
IndexerSettingsHandler::with(Key::Up, &mut app, $block, None).handle();
|
||||
IndexerSettingsHandler::new(Key::Up, &mut app, $block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app
|
||||
@@ -80,7 +80,7 @@ mod tests {
|
||||
1
|
||||
);
|
||||
|
||||
IndexerSettingsHandler::with($key, &mut app, $block, None).handle();
|
||||
IndexerSettingsHandler::new($key, &mut app, $block, None).handle();
|
||||
assert_eq!(
|
||||
app
|
||||
.data
|
||||
@@ -105,7 +105,7 @@ mod tests {
|
||||
BlockSelectionState::new(INDEXER_SETTINGS_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.down();
|
||||
|
||||
IndexerSettingsHandler::with(
|
||||
IndexerSettingsHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt,
|
||||
@@ -138,7 +138,7 @@ mod tests {
|
||||
BlockSelectionState::new(INDEXER_SETTINGS_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.down();
|
||||
|
||||
IndexerSettingsHandler::with(
|
||||
IndexerSettingsHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt,
|
||||
@@ -209,7 +209,7 @@ mod tests {
|
||||
BlockSelectionState::new(INDEXER_SETTINGS_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.y = INDEXER_SETTINGS_SELECTION_BLOCKS.len() - 1;
|
||||
|
||||
IndexerSettingsHandler::with(
|
||||
IndexerSettingsHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt,
|
||||
@@ -219,7 +219,7 @@ mod tests {
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
|
||||
IndexerSettingsHandler::with(
|
||||
IndexerSettingsHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt,
|
||||
@@ -261,7 +261,7 @@ mod tests {
|
||||
.set_index(0, INDEXER_SETTINGS_SELECTION_BLOCKS.len() - 1);
|
||||
app.data.sonarr_data.indexer_settings = Some(IndexerSettings::default());
|
||||
|
||||
IndexerSettingsHandler::with(
|
||||
IndexerSettingsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt,
|
||||
@@ -290,7 +290,7 @@ mod tests {
|
||||
app.data.sonarr_data.indexer_settings = Some(indexer_settings());
|
||||
app.data.sonarr_data.prompt_confirm = true;
|
||||
|
||||
IndexerSettingsHandler::with(
|
||||
IndexerSettingsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt,
|
||||
@@ -316,7 +316,7 @@ mod tests {
|
||||
app.data.sonarr_data.indexer_settings = Some(IndexerSettings::default());
|
||||
app.data.sonarr_data.prompt_confirm = true;
|
||||
|
||||
IndexerSettingsHandler::with(
|
||||
IndexerSettingsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt,
|
||||
@@ -348,7 +348,7 @@ mod tests {
|
||||
BlockSelectionState::new(INDEXER_SETTINGS_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.set_index(0, y_index);
|
||||
|
||||
IndexerSettingsHandler::with(
|
||||
IndexerSettingsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt,
|
||||
@@ -372,7 +372,7 @@ mod tests {
|
||||
BlockSelectionState::new(INDEXER_SETTINGS_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.set_index(0, y_index);
|
||||
|
||||
IndexerSettingsHandler::with(
|
||||
IndexerSettingsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt,
|
||||
@@ -402,7 +402,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AllIndexerSettingsPrompt.into());
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
IndexerSettingsHandler::with(SUBMIT_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
IndexerSettingsHandler::new(SUBMIT_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -429,7 +429,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AllIndexerSettingsPrompt.into());
|
||||
app.data.sonarr_data.indexer_settings = Some(IndexerSettings::default());
|
||||
|
||||
IndexerSettingsHandler::with(
|
||||
IndexerSettingsHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt,
|
||||
@@ -457,7 +457,7 @@ mod tests {
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
app.data.sonarr_data.indexer_settings = Some(IndexerSettings::default());
|
||||
|
||||
IndexerSettingsHandler::with(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
IndexerSettingsHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_eq!(
|
||||
@@ -492,7 +492,7 @@ mod tests {
|
||||
.set_index(0, INDEXER_SETTINGS_SELECTION_BLOCKS.len() - 1);
|
||||
app.data.sonarr_data.indexer_settings = Some(indexer_settings());
|
||||
|
||||
IndexerSettingsHandler::with(
|
||||
IndexerSettingsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt,
|
||||
@@ -526,7 +526,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.data.sonarr_data.indexer_settings = Some(indexer_settings());
|
||||
|
||||
let actual_indexer_settings = IndexerSettingsHandler::with(
|
||||
let actual_indexer_settings = IndexerSettingsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt,
|
||||
@@ -544,7 +544,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = IndexerSettingsHandler::with(
|
||||
let handler = IndexerSettingsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt,
|
||||
@@ -560,7 +560,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = IndexerSettingsHandler::with(
|
||||
let handler = IndexerSettingsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt,
|
||||
@@ -577,7 +577,7 @@ mod tests {
|
||||
app.is_loading = false;
|
||||
app.data.sonarr_data.indexer_settings = Some(IndexerSettings::default());
|
||||
|
||||
let handler = IndexerSettingsHandler::with(
|
||||
let handler = IndexerSettingsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AllIndexerSettingsPrompt,
|
||||
|
||||
@@ -33,7 +33,7 @@ mod tests {
|
||||
.indexers
|
||||
.set_items(vec![Indexer::default()]);
|
||||
|
||||
IndexersHandler::with(DELETE_KEY, &mut app, ActiveSonarrBlock::Indexers, None).handle();
|
||||
IndexersHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::Indexers, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -52,7 +52,7 @@ mod tests {
|
||||
.indexers
|
||||
.set_items(vec![Indexer::default()]);
|
||||
|
||||
IndexersHandler::with(DELETE_KEY, &mut app, ActiveSonarrBlock::Indexers, None).handle();
|
||||
IndexersHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::Indexers, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
}
|
||||
@@ -71,7 +71,7 @@ mod tests {
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(5);
|
||||
|
||||
IndexersHandler::with(
|
||||
IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Indexers,
|
||||
@@ -96,7 +96,7 @@ mod tests {
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(5);
|
||||
|
||||
IndexersHandler::with(
|
||||
IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Indexers,
|
||||
@@ -118,11 +118,11 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
|
||||
IndexersHandler::with(key, &mut app, ActiveSonarrBlock::DeleteIndexerPrompt, None).handle();
|
||||
IndexersHandler::new(key, &mut app, ActiveSonarrBlock::DeleteIndexerPrompt, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
|
||||
IndexersHandler::with(key, &mut app, ActiveSonarrBlock::DeleteIndexerPrompt, None).handle();
|
||||
IndexersHandler::new(key, &mut app, ActiveSonarrBlock::DeleteIndexerPrompt, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
@@ -199,7 +199,7 @@ mod tests {
|
||||
sonarr_data.indexers.set_items(vec![indexer]);
|
||||
app.data.sonarr_data = sonarr_data;
|
||||
|
||||
IndexersHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Indexers, None).handle();
|
||||
IndexersHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Indexers, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -238,7 +238,7 @@ mod tests {
|
||||
.indexers
|
||||
.set_items(vec![Indexer::default()]);
|
||||
|
||||
IndexersHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Indexers, None).handle();
|
||||
IndexersHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Indexers, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_eq!(app.data.sonarr_data.edit_indexer_modal, None);
|
||||
@@ -252,7 +252,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::DeleteIndexerPrompt.into());
|
||||
|
||||
IndexersHandler::with(
|
||||
IndexersHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteIndexerPrompt,
|
||||
@@ -279,7 +279,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::DeleteIndexerPrompt.into());
|
||||
|
||||
IndexersHandler::with(
|
||||
IndexersHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteIndexerPrompt,
|
||||
@@ -308,7 +308,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::DeleteIndexerPrompt.into());
|
||||
app.data.sonarr_data.prompt_confirm = true;
|
||||
|
||||
IndexersHandler::with(
|
||||
IndexersHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteIndexerPrompt,
|
||||
@@ -328,7 +328,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::TestIndexer.into());
|
||||
|
||||
IndexersHandler::with(ESC_KEY, &mut app, ActiveSonarrBlock::TestIndexer, None).handle();
|
||||
IndexersHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::TestIndexer, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert_eq!(app.data.sonarr_data.indexer_test_errors, None);
|
||||
@@ -342,7 +342,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
|
||||
IndexersHandler::with(ESC_KEY, &mut app, ActiveSonarrBlock::Indexers, None).handle();
|
||||
IndexersHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::Indexers, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Indexers.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
@@ -369,7 +369,7 @@ mod tests {
|
||||
.set_items(vec![Indexer::default()]);
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
|
||||
IndexersHandler::with(
|
||||
IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Indexers,
|
||||
@@ -392,7 +392,7 @@ mod tests {
|
||||
.set_items(vec![Indexer::default()]);
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
|
||||
IndexersHandler::with(
|
||||
IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Indexers,
|
||||
@@ -419,7 +419,7 @@ mod tests {
|
||||
.indexers
|
||||
.set_items(vec![Indexer::default()]);
|
||||
|
||||
IndexersHandler::with(
|
||||
IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.settings.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Indexers,
|
||||
@@ -448,7 +448,7 @@ mod tests {
|
||||
.indexers
|
||||
.set_items(vec![Indexer::default()]);
|
||||
|
||||
IndexersHandler::with(
|
||||
IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.settings.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Indexers,
|
||||
@@ -469,7 +469,7 @@ mod tests {
|
||||
.indexers
|
||||
.set_items(vec![Indexer::default()]);
|
||||
|
||||
IndexersHandler::with(
|
||||
IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.test.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Indexers,
|
||||
@@ -494,7 +494,7 @@ mod tests {
|
||||
.indexers
|
||||
.set_items(vec![Indexer::default()]);
|
||||
|
||||
IndexersHandler::with(
|
||||
IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.test.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Indexers,
|
||||
@@ -515,7 +515,7 @@ mod tests {
|
||||
.indexers
|
||||
.set_items(vec![Indexer::default()]);
|
||||
|
||||
IndexersHandler::with(
|
||||
IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.test_all.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Indexers,
|
||||
@@ -540,7 +540,7 @@ mod tests {
|
||||
.indexers
|
||||
.set_items(vec![Indexer::default()]);
|
||||
|
||||
IndexersHandler::with(
|
||||
IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.test_all.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Indexers,
|
||||
@@ -558,7 +558,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::DeleteIndexerPrompt.into());
|
||||
|
||||
IndexersHandler::with(
|
||||
IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteIndexerPrompt,
|
||||
@@ -648,7 +648,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.data.sonarr_data.indexers.set_items(vec![indexer()]);
|
||||
|
||||
let indexer_id = IndexersHandler::with(
|
||||
let indexer_id = IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Indexers,
|
||||
@@ -665,7 +665,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = IndexersHandler::with(
|
||||
let handler = IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Indexers,
|
||||
@@ -681,7 +681,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = IndexersHandler::with(
|
||||
let handler = IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Indexers,
|
||||
@@ -702,7 +702,7 @@ mod tests {
|
||||
.indexers
|
||||
.set_items(vec![Indexer::default()]);
|
||||
|
||||
let handler = IndexersHandler::with(
|
||||
let handler = IndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Indexers,
|
||||
|
||||
@@ -47,15 +47,15 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for IndexersHandler<'a,
|
||||
if !self.handle_indexers_table_events(indexers_table_handling_config) {
|
||||
match self.active_sonarr_block {
|
||||
_ if EditIndexerHandler::accepts(self.active_sonarr_block) => {
|
||||
EditIndexerHandler::with(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
EditIndexerHandler::new(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
.handle()
|
||||
}
|
||||
_ if IndexerSettingsHandler::accepts(self.active_sonarr_block) => {
|
||||
IndexerSettingsHandler::with(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
IndexerSettingsHandler::new(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
.handle()
|
||||
}
|
||||
_ if TestAllIndexersHandler::accepts(self.active_sonarr_block) => {
|
||||
TestAllIndexersHandler::with(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
TestAllIndexersHandler::new(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
.handle()
|
||||
}
|
||||
_ => self.handle_key_event(),
|
||||
@@ -70,7 +70,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for IndexersHandler<'a,
|
||||
|| INDEXERS_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -48,7 +48,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for TestAllIndexersHandl
|
||||
active_block == ActiveSonarrBlock::TestAllIndexers
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -23,7 +23,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::TestAllIndexers.into());
|
||||
app.data.sonarr_data.indexer_test_all_results = Some(StatefulTable::default());
|
||||
|
||||
TestAllIndexersHandler::with(
|
||||
TestAllIndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::TestAllIndexers,
|
||||
@@ -54,7 +54,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = TestAllIndexersHandler::with(
|
||||
let handler = TestAllIndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::TestAllIndexers,
|
||||
@@ -70,7 +70,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Indexers.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = TestAllIndexersHandler::with(
|
||||
let handler = TestAllIndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::TestAllIndexers,
|
||||
@@ -87,7 +87,7 @@ mod tests {
|
||||
app.is_loading = false;
|
||||
app.data.sonarr_data.indexer_test_all_results = Some(StatefulTable::default());
|
||||
|
||||
let handler = TestAllIndexersHandler::with(
|
||||
let handler = TestAllIndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::TestAllIndexers,
|
||||
@@ -106,7 +106,7 @@ mod tests {
|
||||
indexer_test_results.set_items(vec![IndexerTestResultModalItem::default()]);
|
||||
app.data.sonarr_data.indexer_test_all_results = Some(indexer_test_results);
|
||||
|
||||
let handler = TestAllIndexersHandler::with(
|
||||
let handler = TestAllIndexersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::TestAllIndexers,
|
||||
|
||||
@@ -132,7 +132,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for AddSeriesHandler<'a,
|
||||
ADD_SERIES_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -50,7 +50,7 @@ mod tests {
|
||||
|
||||
if key == Key::Up {
|
||||
for i in (0..monitor_vec.len()).rev() {
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectMonitor,
|
||||
@@ -72,7 +72,7 @@ mod tests {
|
||||
}
|
||||
} else {
|
||||
for i in 0..monitor_vec.len() {
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectMonitor,
|
||||
@@ -114,7 +114,7 @@ mod tests {
|
||||
|
||||
if key == Key::Up {
|
||||
for i in (0..series_type_vec.len()).rev() {
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectSeriesType,
|
||||
@@ -136,7 +136,7 @@ mod tests {
|
||||
}
|
||||
} else {
|
||||
for i in 0..series_type_vec.len() {
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectSeriesType,
|
||||
@@ -175,7 +175,7 @@ mod tests {
|
||||
.quality_profile_list
|
||||
.set_items(vec!["Test 1".to_owned(), "Test 2".to_owned()]);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectQualityProfile,
|
||||
@@ -195,7 +195,7 @@ mod tests {
|
||||
"Test 2"
|
||||
);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectQualityProfile,
|
||||
@@ -232,7 +232,7 @@ mod tests {
|
||||
.language_profile_list
|
||||
.set_items(vec!["Test 1".to_owned(), "Test 2".to_owned()]);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectLanguageProfile,
|
||||
@@ -252,7 +252,7 @@ mod tests {
|
||||
"Test 2"
|
||||
);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectLanguageProfile,
|
||||
@@ -289,7 +289,7 @@ mod tests {
|
||||
.root_folder_list
|
||||
.set_items(simple_stateful_iterable_vec!(RootFolder, String, path));
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectRootFolder,
|
||||
@@ -310,7 +310,7 @@ mod tests {
|
||||
"Test 2"
|
||||
);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectRootFolder,
|
||||
@@ -339,7 +339,7 @@ mod tests {
|
||||
app.data.sonarr_data.selected_block = BlockSelectionState::new(ADD_SERIES_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.down();
|
||||
|
||||
AddSeriesHandler::with(key, &mut app, ActiveSonarrBlock::AddSeriesPrompt, None).handle();
|
||||
AddSeriesHandler::new(key, &mut app, ActiveSonarrBlock::AddSeriesPrompt, None).handle();
|
||||
|
||||
if key == Key::Up {
|
||||
assert_eq!(
|
||||
@@ -362,7 +362,7 @@ mod tests {
|
||||
app.data.sonarr_data.selected_block = BlockSelectionState::new(ADD_SERIES_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.down();
|
||||
|
||||
AddSeriesHandler::with(key, &mut app, ActiveSonarrBlock::AddSeriesPrompt, None).handle();
|
||||
AddSeriesHandler::new(key, &mut app, ActiveSonarrBlock::AddSeriesPrompt, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.selected_block.get_active_block(),
|
||||
@@ -397,7 +397,7 @@ mod tests {
|
||||
.monitor_list
|
||||
.set_items(monitor_vec.clone());
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectMonitor,
|
||||
@@ -417,7 +417,7 @@ mod tests {
|
||||
&monitor_vec[monitor_vec.len() - 1]
|
||||
);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectMonitor,
|
||||
@@ -453,7 +453,7 @@ mod tests {
|
||||
.series_type_list
|
||||
.set_items(series_type_vec.clone());
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectSeriesType,
|
||||
@@ -473,7 +473,7 @@ mod tests {
|
||||
&series_type_vec[series_type_vec.len() - 1]
|
||||
);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectSeriesType,
|
||||
@@ -512,7 +512,7 @@ mod tests {
|
||||
"Test 3".to_owned(),
|
||||
]);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectQualityProfile,
|
||||
@@ -532,7 +532,7 @@ mod tests {
|
||||
"Test 3"
|
||||
);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectQualityProfile,
|
||||
@@ -571,7 +571,7 @@ mod tests {
|
||||
"Test 3".to_owned(),
|
||||
]);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectLanguageProfile,
|
||||
@@ -591,7 +591,7 @@ mod tests {
|
||||
"Test 3"
|
||||
);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectLanguageProfile,
|
||||
@@ -626,7 +626,7 @@ mod tests {
|
||||
.root_folder_list
|
||||
.set_items(extended_stateful_iterable_vec!(RootFolder, String, path));
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectRootFolder,
|
||||
@@ -647,7 +647,7 @@ mod tests {
|
||||
"Test 3"
|
||||
);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSelectRootFolder,
|
||||
@@ -675,7 +675,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.data.sonarr_data.add_series_search = Some("Test".into());
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSearchInput,
|
||||
@@ -695,7 +695,7 @@ mod tests {
|
||||
4
|
||||
);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSearchInput,
|
||||
@@ -725,7 +725,7 @@ mod tests {
|
||||
..AddSeriesModal::default()
|
||||
});
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesTagsInput,
|
||||
@@ -746,7 +746,7 @@ mod tests {
|
||||
4
|
||||
);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesTagsInput,
|
||||
@@ -783,11 +783,11 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
|
||||
AddSeriesHandler::with(key, &mut app, ActiveSonarrBlock::AddSeriesPrompt, None).handle();
|
||||
AddSeriesHandler::new(key, &mut app, ActiveSonarrBlock::AddSeriesPrompt, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
|
||||
AddSeriesHandler::with(key, &mut app, ActiveSonarrBlock::AddSeriesPrompt, None).handle();
|
||||
AddSeriesHandler::new(key, &mut app, ActiveSonarrBlock::AddSeriesPrompt, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
@@ -798,7 +798,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.data.sonarr_data.add_series_search = Some("Test".into());
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSearchInput,
|
||||
@@ -818,7 +818,7 @@ mod tests {
|
||||
1
|
||||
);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSearchInput,
|
||||
@@ -848,7 +848,7 @@ mod tests {
|
||||
..AddSeriesModal::default()
|
||||
});
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesTagsInput,
|
||||
@@ -869,7 +869,7 @@ mod tests {
|
||||
1
|
||||
);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesTagsInput,
|
||||
@@ -915,7 +915,7 @@ mod tests {
|
||||
app.should_ignore_quit_key = true;
|
||||
app.data.sonarr_data.add_series_search = Some("test".into());
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSearchInput,
|
||||
@@ -938,7 +938,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddSeriesSearchInput.into());
|
||||
app.should_ignore_quit_key = true;
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSearchInput,
|
||||
@@ -963,7 +963,7 @@ mod tests {
|
||||
app.data.sonarr_data.quality_profile_map =
|
||||
BiMap::from_iter([(1, "B - Test 2".to_owned()), (0, "A - Test 1".to_owned())]);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSearchResults,
|
||||
@@ -1029,7 +1029,7 @@ mod tests {
|
||||
let mut add_searched_series = StatefulTable::default();
|
||||
add_searched_series.set_items(vec![AddSeriesSearchResult::default()]);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSearchResults,
|
||||
@@ -1049,7 +1049,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddSeriesSearchResults.into());
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSearchResults,
|
||||
@@ -1076,7 +1076,7 @@ mod tests {
|
||||
.series
|
||||
.set_items(vec![Series::default()]);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSearchResults,
|
||||
@@ -1102,7 +1102,7 @@ mod tests {
|
||||
.selected_block
|
||||
.set_index(0, ADD_SERIES_SELECTION_BLOCKS.len() - 1);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesPrompt,
|
||||
@@ -1185,7 +1185,7 @@ mod tests {
|
||||
.selected_block
|
||||
.set_index(0, ADD_SERIES_SELECTION_BLOCKS.len() - 1);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesPrompt,
|
||||
@@ -1218,7 +1218,7 @@ mod tests {
|
||||
app.data.sonarr_data.selected_block = BlockSelectionState::new(ADD_SERIES_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.set_index(0, y_index);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesPrompt,
|
||||
@@ -1251,7 +1251,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddSeriesPrompt.into());
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
AddSeriesHandler::with(SUBMIT_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
AddSeriesHandler::new(SUBMIT_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -1272,7 +1272,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddSeriesPrompt.into());
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesPrompt,
|
||||
@@ -1294,7 +1294,7 @@ mod tests {
|
||||
.use_season_folder
|
||||
);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesPrompt,
|
||||
@@ -1340,7 +1340,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddSeriesSearchInput.into());
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSearchInput,
|
||||
@@ -1362,7 +1362,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddSeriesPrompt.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddSeriesTagsInput.into());
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesTagsInput,
|
||||
@@ -1396,7 +1396,7 @@ mod tests {
|
||||
));
|
||||
app.data.sonarr_data.add_searched_series = Some(add_searched_series);
|
||||
|
||||
AddSeriesHandler::with(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
AddSeriesHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -1414,7 +1414,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddSeriesSearchResults.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddSeriesAlreadyInLibrary.into());
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesAlreadyInLibrary,
|
||||
@@ -1437,7 +1437,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddSeriesSearchResults.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddSeriesPrompt.into());
|
||||
|
||||
AddSeriesHandler::with(ESC_KEY, &mut app, ActiveSonarrBlock::AddSeriesPrompt, None).handle();
|
||||
AddSeriesHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::AddSeriesPrompt, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
@@ -1456,7 +1456,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddSeriesPrompt.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddSeriesTagsInput.into());
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesTagsInput,
|
||||
@@ -1487,7 +1487,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddSeriesPrompt.into());
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
AddSeriesHandler::with(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
AddSeriesHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -1513,7 +1513,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.data.sonarr_data.add_series_search = Some("Test".into());
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.backspace.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSearchInput,
|
||||
@@ -1542,7 +1542,7 @@ mod tests {
|
||||
..AddSeriesModal::default()
|
||||
});
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.backspace.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesTagsInput,
|
||||
@@ -1569,7 +1569,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.data.sonarr_data.add_series_search = Some(HorizontallyScrollableText::default());
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
Key::Char('h'),
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSearchInput,
|
||||
@@ -1595,7 +1595,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.data.sonarr_data.add_series_modal = Some(AddSeriesModal::default());
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
Key::Char('h'),
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesTagsInput,
|
||||
@@ -1686,7 +1686,7 @@ mod tests {
|
||||
.selected_block
|
||||
.set_index(0, ADD_SERIES_SELECTION_BLOCKS.len() - 1);
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesPrompt,
|
||||
@@ -1719,7 +1719,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.data.sonarr_data.add_series_search = None;
|
||||
|
||||
AddSeriesHandler::with(
|
||||
AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesSearchResults,
|
||||
@@ -1789,7 +1789,7 @@ mod tests {
|
||||
},
|
||||
};
|
||||
|
||||
let add_series_body = AddSeriesHandler::with(
|
||||
let add_series_body = AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesPrompt,
|
||||
@@ -1807,7 +1807,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = AddSeriesHandler::with(
|
||||
let handler = AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesPrompt,
|
||||
@@ -1823,7 +1823,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = AddSeriesHandler::with(
|
||||
let handler = AddSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddSeriesPrompt,
|
||||
|
||||
@@ -38,7 +38,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for DeleteSeriesHandler<
|
||||
DELETE_SERIES_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -28,7 +28,7 @@ mod tests {
|
||||
BlockSelectionState::new(DELETE_SERIES_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.down();
|
||||
|
||||
DeleteSeriesHandler::with(key, &mut app, ActiveSonarrBlock::DeleteSeriesPrompt, None)
|
||||
DeleteSeriesHandler::new(key, &mut app, ActiveSonarrBlock::DeleteSeriesPrompt, None)
|
||||
.handle();
|
||||
|
||||
if key == Key::Up {
|
||||
@@ -54,7 +54,7 @@ mod tests {
|
||||
BlockSelectionState::new(DELETE_SERIES_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.down();
|
||||
|
||||
DeleteSeriesHandler::with(key, &mut app, ActiveSonarrBlock::DeleteSeriesPrompt, None)
|
||||
DeleteSeriesHandler::new(key, &mut app, ActiveSonarrBlock::DeleteSeriesPrompt, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -74,12 +74,12 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::DeleteSeriesPrompt.into());
|
||||
|
||||
DeleteSeriesHandler::with(key, &mut app, ActiveSonarrBlock::DeleteSeriesPrompt, None)
|
||||
DeleteSeriesHandler::new(key, &mut app, ActiveSonarrBlock::DeleteSeriesPrompt, None)
|
||||
.handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
|
||||
DeleteSeriesHandler::with(key, &mut app, ActiveSonarrBlock::DeleteSeriesPrompt, None)
|
||||
DeleteSeriesHandler::new(key, &mut app, ActiveSonarrBlock::DeleteSeriesPrompt, None)
|
||||
.handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
@@ -112,7 +112,7 @@ mod tests {
|
||||
app.data.sonarr_data.delete_series_files = true;
|
||||
app.data.sonarr_data.add_list_exclusion = true;
|
||||
|
||||
DeleteSeriesHandler::with(
|
||||
DeleteSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteSeriesPrompt,
|
||||
@@ -149,7 +149,7 @@ mod tests {
|
||||
.selected_block
|
||||
.set_index(0, DELETE_SERIES_SELECTION_BLOCKS.len() - 1);
|
||||
|
||||
DeleteSeriesHandler::with(
|
||||
DeleteSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteSeriesPrompt,
|
||||
@@ -178,7 +178,7 @@ mod tests {
|
||||
app.data.sonarr_data.delete_series_files = true;
|
||||
app.data.sonarr_data.add_list_exclusion = true;
|
||||
|
||||
DeleteSeriesHandler::with(
|
||||
DeleteSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteSeriesPrompt,
|
||||
@@ -205,7 +205,7 @@ mod tests {
|
||||
BlockSelectionState::new(DELETE_SERIES_SELECTION_BLOCKS);
|
||||
app.push_navigation_stack(ActiveSonarrBlock::DeleteSeriesPrompt.into());
|
||||
|
||||
DeleteSeriesHandler::with(
|
||||
DeleteSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteSeriesPrompt,
|
||||
@@ -216,7 +216,7 @@ mod tests {
|
||||
assert_eq!(app.get_current_route(), current_route);
|
||||
assert_eq!(app.data.sonarr_data.delete_series_files, true);
|
||||
|
||||
DeleteSeriesHandler::with(
|
||||
DeleteSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteSeriesPrompt,
|
||||
@@ -246,7 +246,7 @@ mod tests {
|
||||
app.data.sonarr_data.delete_series_files = true;
|
||||
app.data.sonarr_data.add_list_exclusion = true;
|
||||
|
||||
DeleteSeriesHandler::with(
|
||||
DeleteSeriesHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteSeriesPrompt,
|
||||
@@ -293,7 +293,7 @@ mod tests {
|
||||
.selected_block
|
||||
.set_index(0, DELETE_SERIES_SELECTION_BLOCKS.len() - 1);
|
||||
|
||||
DeleteSeriesHandler::with(
|
||||
DeleteSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteSeriesPrompt,
|
||||
@@ -336,7 +336,7 @@ mod tests {
|
||||
add_list_exclusion: true,
|
||||
};
|
||||
|
||||
let delete_series_params = DeleteSeriesHandler::with(
|
||||
let delete_series_params = DeleteSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteSeriesPrompt,
|
||||
@@ -354,7 +354,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = DeleteSeriesHandler::with(
|
||||
let handler = DeleteSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteSeriesPrompt,
|
||||
@@ -369,7 +369,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = DeleteSeriesHandler::with(
|
||||
let handler = DeleteSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteSeriesPrompt,
|
||||
|
||||
@@ -97,7 +97,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for EditSeriesHandler<'a
|
||||
EDIT_SERIES_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -44,7 +44,7 @@ mod tests {
|
||||
|
||||
if key == Key::Up {
|
||||
for i in (0..series_type_vec.len()).rev() {
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesSelectSeriesType,
|
||||
@@ -66,7 +66,7 @@ mod tests {
|
||||
}
|
||||
} else {
|
||||
for i in 0..series_type_vec.len() {
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesSelectSeriesType,
|
||||
@@ -105,7 +105,7 @@ mod tests {
|
||||
.quality_profile_list
|
||||
.set_items(vec!["Test 1".to_owned(), "Test 2".to_owned()]);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesSelectQualityProfile,
|
||||
@@ -125,7 +125,7 @@ mod tests {
|
||||
"Test 2"
|
||||
);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesSelectQualityProfile,
|
||||
@@ -162,7 +162,7 @@ mod tests {
|
||||
.language_profile_list
|
||||
.set_items(vec!["Test 1".to_owned(), "Test 2".to_owned()]);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesSelectLanguageProfile,
|
||||
@@ -182,7 +182,7 @@ mod tests {
|
||||
"Test 2"
|
||||
);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesSelectLanguageProfile,
|
||||
@@ -211,7 +211,7 @@ mod tests {
|
||||
app.data.sonarr_data.selected_block = BlockSelectionState::new(EDIT_SERIES_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.down();
|
||||
|
||||
EditSeriesHandler::with(key, &mut app, ActiveSonarrBlock::EditSeriesPrompt, None).handle();
|
||||
EditSeriesHandler::new(key, &mut app, ActiveSonarrBlock::EditSeriesPrompt, None).handle();
|
||||
|
||||
if key == Key::Up {
|
||||
assert_eq!(
|
||||
@@ -235,7 +235,7 @@ mod tests {
|
||||
app.data.sonarr_data.selected_block = BlockSelectionState::new(EDIT_SERIES_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.down();
|
||||
|
||||
EditSeriesHandler::with(key, &mut app, ActiveSonarrBlock::EditSeriesPrompt, None).handle();
|
||||
EditSeriesHandler::new(key, &mut app, ActiveSonarrBlock::EditSeriesPrompt, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.data.sonarr_data.selected_block.get_active_block(),
|
||||
@@ -269,7 +269,7 @@ mod tests {
|
||||
.series_type_list
|
||||
.set_items(series_type_vec.clone());
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesSelectSeriesType,
|
||||
@@ -289,7 +289,7 @@ mod tests {
|
||||
&series_type_vec[series_type_vec.len() - 1]
|
||||
);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesSelectSeriesType,
|
||||
@@ -328,7 +328,7 @@ mod tests {
|
||||
"Test 3".to_owned(),
|
||||
]);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesSelectQualityProfile,
|
||||
@@ -348,7 +348,7 @@ mod tests {
|
||||
"Test 3"
|
||||
);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesSelectQualityProfile,
|
||||
@@ -387,7 +387,7 @@ mod tests {
|
||||
"Test 3".to_owned(),
|
||||
]);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesSelectLanguageProfile,
|
||||
@@ -407,7 +407,7 @@ mod tests {
|
||||
"Test 3"
|
||||
);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesSelectLanguageProfile,
|
||||
@@ -437,7 +437,7 @@ mod tests {
|
||||
..EditSeriesModal::default()
|
||||
});
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPathInput,
|
||||
@@ -458,7 +458,7 @@ mod tests {
|
||||
4
|
||||
);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPathInput,
|
||||
@@ -489,7 +489,7 @@ mod tests {
|
||||
..EditSeriesModal::default()
|
||||
});
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesTagsInput,
|
||||
@@ -510,7 +510,7 @@ mod tests {
|
||||
4
|
||||
);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesTagsInput,
|
||||
@@ -547,11 +547,11 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
|
||||
EditSeriesHandler::with(key, &mut app, ActiveSonarrBlock::EditSeriesPrompt, None).handle();
|
||||
EditSeriesHandler::new(key, &mut app, ActiveSonarrBlock::EditSeriesPrompt, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
|
||||
EditSeriesHandler::with(key, &mut app, ActiveSonarrBlock::EditSeriesPrompt, None).handle();
|
||||
EditSeriesHandler::new(key, &mut app, ActiveSonarrBlock::EditSeriesPrompt, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
@@ -565,7 +565,7 @@ mod tests {
|
||||
..EditSeriesModal::default()
|
||||
});
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPathInput,
|
||||
@@ -586,7 +586,7 @@ mod tests {
|
||||
1
|
||||
);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPathInput,
|
||||
@@ -617,7 +617,7 @@ mod tests {
|
||||
..EditSeriesModal::default()
|
||||
});
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesTagsInput,
|
||||
@@ -638,7 +638,7 @@ mod tests {
|
||||
1
|
||||
);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesTagsInput,
|
||||
@@ -686,7 +686,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditSeriesPrompt.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditSeriesPathInput.into());
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPathInput,
|
||||
@@ -722,7 +722,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditSeriesPrompt.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditSeriesPathInput.into());
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesTagsInput,
|
||||
@@ -759,7 +759,7 @@ mod tests {
|
||||
.selected_block
|
||||
.set_index(0, EDIT_SERIES_SELECTION_BLOCKS.len() - 1);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPrompt,
|
||||
@@ -821,7 +821,7 @@ mod tests {
|
||||
.selected_block
|
||||
.set_index(0, EDIT_SERIES_SELECTION_BLOCKS.len() - 1);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPrompt,
|
||||
@@ -847,7 +847,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditSeriesPrompt.into());
|
||||
app.data.sonarr_data.prompt_confirm = true;
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPrompt,
|
||||
@@ -875,7 +875,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.push_navigation_stack(current_route);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPrompt,
|
||||
@@ -895,7 +895,7 @@ mod tests {
|
||||
Some(true)
|
||||
);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPrompt,
|
||||
@@ -929,7 +929,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.push_navigation_stack(current_route);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPrompt,
|
||||
@@ -949,7 +949,7 @@ mod tests {
|
||||
Some(true)
|
||||
);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPrompt,
|
||||
@@ -993,7 +993,7 @@ mod tests {
|
||||
app.data.sonarr_data.selected_block = BlockSelectionState::new(EDIT_SERIES_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.set_index(0, y_index);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPrompt,
|
||||
@@ -1032,7 +1032,7 @@ mod tests {
|
||||
app.data.sonarr_data.selected_block = BlockSelectionState::new(EDIT_SERIES_SELECTION_BLOCKS);
|
||||
app.data.sonarr_data.selected_block.set_index(0, y_index);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPrompt,
|
||||
@@ -1069,7 +1069,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditSeriesPrompt.into());
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -1116,7 +1116,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EditSeriesPrompt.into());
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
EditSeriesHandler::with(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
EditSeriesHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert!(!app.should_ignore_quit_key);
|
||||
assert_eq!(
|
||||
@@ -1133,7 +1133,7 @@ mod tests {
|
||||
app.data.sonarr_data = create_test_sonarr_data();
|
||||
app.data.sonarr_data.edit_series_modal = Some(EditSeriesModal::default());
|
||||
|
||||
EditSeriesHandler::with(ESC_KEY, &mut app, ActiveSonarrBlock::EditSeriesPrompt, None)
|
||||
EditSeriesHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::EditSeriesPrompt, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
@@ -1158,7 +1158,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
EditSeriesHandler::with(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
EditSeriesHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
}
|
||||
@@ -1186,7 +1186,7 @@ mod tests {
|
||||
..EditSeriesModal::default()
|
||||
});
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.backspace.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPathInput,
|
||||
@@ -1216,7 +1216,7 @@ mod tests {
|
||||
..EditSeriesModal::default()
|
||||
});
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.backspace.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesTagsInput,
|
||||
@@ -1243,7 +1243,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.data.sonarr_data.edit_series_modal = Some(EditSeriesModal::default());
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
Key::Char('h'),
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPathInput,
|
||||
@@ -1270,7 +1270,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.data.sonarr_data.edit_series_modal = Some(EditSeriesModal::default());
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
Key::Char('h'),
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesTagsInput,
|
||||
@@ -1340,7 +1340,7 @@ mod tests {
|
||||
.selected_block
|
||||
.set_index(0, EDIT_SERIES_SELECTION_BLOCKS.len() - 1);
|
||||
|
||||
EditSeriesHandler::with(
|
||||
EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPrompt,
|
||||
@@ -1410,7 +1410,7 @@ mod tests {
|
||||
..EditSeriesParams::default()
|
||||
};
|
||||
|
||||
let edit_series_params = EditSeriesHandler::with(
|
||||
let edit_series_params = EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPrompt,
|
||||
@@ -1428,7 +1428,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = EditSeriesHandler::with(
|
||||
let handler = EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPrompt,
|
||||
@@ -1444,7 +1444,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = EditSeriesHandler::with(
|
||||
let handler = EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPrompt,
|
||||
@@ -1461,7 +1461,7 @@ mod tests {
|
||||
app.is_loading = false;
|
||||
app.data.sonarr_data.edit_series_modal = Some(EditSeriesModal::default());
|
||||
|
||||
let handler = EditSeriesHandler::with(
|
||||
let handler = EditSeriesHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EditSeriesPrompt,
|
||||
|
||||
@@ -88,7 +88,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for EpisodeDetailsHandle
|
||||
EPISODE_DETAILS_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_sonarr_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -34,11 +34,11 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EpisodeDetails.into());
|
||||
|
||||
EpisodeDetailsHandler::with(key, &mut app, active_sonarr_block, None).handle();
|
||||
EpisodeDetailsHandler::new(key, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
|
||||
EpisodeDetailsHandler::with(key, &mut app, active_sonarr_block, None).handle();
|
||||
EpisodeDetailsHandler::new(key, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ mod tests {
|
||||
.position(|tab_route| tab_route.route == right_block.into())
|
||||
.unwrap_or_default();
|
||||
|
||||
EpisodeDetailsHandler::with(DEFAULT_KEYBINDINGS.left.key, &mut app, right_block, None)
|
||||
EpisodeDetailsHandler::new(DEFAULT_KEYBINDINGS.left.key, &mut app, right_block, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -105,7 +105,7 @@ mod tests {
|
||||
);
|
||||
assert_eq!(app.get_current_route(), left_block.into());
|
||||
|
||||
EpisodeDetailsHandler::with(DEFAULT_KEYBINDINGS.right.key, &mut app, left_block, None)
|
||||
EpisodeDetailsHandler::new(DEFAULT_KEYBINDINGS.right.key, &mut app, left_block, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -140,7 +140,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.data.sonarr_data = create_test_sonarr_data();
|
||||
|
||||
EpisodeDetailsHandler::with(
|
||||
EpisodeDetailsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EpisodeHistory,
|
||||
@@ -170,7 +170,7 @@ mod tests {
|
||||
.episode_history = StatefulTable::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EpisodeHistory.into());
|
||||
|
||||
EpisodeDetailsHandler::with(
|
||||
EpisodeDetailsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EpisodeHistory,
|
||||
@@ -191,7 +191,7 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EpisodeHistory.into());
|
||||
|
||||
EpisodeDetailsHandler::with(
|
||||
EpisodeDetailsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EpisodeHistory,
|
||||
@@ -235,7 +235,7 @@ mod tests {
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
EpisodeDetailsHandler::with(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
EpisodeDetailsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.get_current_route(), active_sonarr_block.into());
|
||||
@@ -253,7 +253,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::ManualEpisodeSearch.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::ManualEpisodeSearchConfirmPrompt.into());
|
||||
|
||||
EpisodeDetailsHandler::with(
|
||||
EpisodeDetailsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::ManualEpisodeSearchConfirmPrompt,
|
||||
@@ -290,7 +290,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EpisodeDetails.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
EpisodeDetailsHandler::with(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
EpisodeDetailsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
@@ -306,7 +306,7 @@ mod tests {
|
||||
app.data.sonarr_data = create_test_sonarr_data();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::ManualEpisodeSearch.into());
|
||||
|
||||
EpisodeDetailsHandler::with(
|
||||
EpisodeDetailsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::ManualEpisodeSearch,
|
||||
@@ -327,7 +327,7 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::ManualEpisodeSearch.into());
|
||||
|
||||
EpisodeDetailsHandler::with(
|
||||
EpisodeDetailsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::ManualEpisodeSearch,
|
||||
@@ -356,7 +356,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EpisodeHistory.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EpisodeHistoryDetails.into());
|
||||
|
||||
EpisodeDetailsHandler::with(
|
||||
EpisodeDetailsHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EpisodeHistoryDetails,
|
||||
@@ -386,7 +386,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EpisodeDetails.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
EpisodeDetailsHandler::with(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
EpisodeDetailsHandler::new(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
@@ -410,7 +410,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonDetails.into());
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
EpisodeDetailsHandler::with(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
EpisodeDetailsHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -447,7 +447,7 @@ mod tests {
|
||||
app.data.sonarr_data = create_test_sonarr_data();
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
EpisodeDetailsHandler::with(
|
||||
EpisodeDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.auto_search.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -475,7 +475,7 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
EpisodeDetailsHandler::with(
|
||||
EpisodeDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.auto_search.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -501,7 +501,7 @@ mod tests {
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
app.is_routing = false;
|
||||
|
||||
EpisodeDetailsHandler::with(
|
||||
EpisodeDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -529,7 +529,7 @@ mod tests {
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
app.is_routing = false;
|
||||
|
||||
EpisodeDetailsHandler::with(
|
||||
EpisodeDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -565,7 +565,7 @@ mod tests {
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AutomaticallySearchEpisodePrompt.into());
|
||||
|
||||
EpisodeDetailsHandler::with(
|
||||
EpisodeDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AutomaticallySearchEpisodePrompt,
|
||||
@@ -589,7 +589,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::ManualEpisodeSearch.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::ManualEpisodeSearchConfirmPrompt.into());
|
||||
|
||||
EpisodeDetailsHandler::with(
|
||||
EpisodeDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::ManualEpisodeSearchConfirmPrompt,
|
||||
@@ -632,7 +632,7 @@ mod tests {
|
||||
season_details_modal.episodes.set_items(vec![episode()]);
|
||||
app.data.sonarr_data.season_details_modal = Some(season_details_modal);
|
||||
|
||||
let episode_id = EpisodeDetailsHandler::with(
|
||||
let episode_id = EpisodeDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EpisodeDetails,
|
||||
@@ -648,7 +648,7 @@ mod tests {
|
||||
fn test_extract_episode_id_panics_when_season_details_modal_is_none() {
|
||||
let mut app = App::default();
|
||||
|
||||
EpisodeDetailsHandler::with(
|
||||
EpisodeDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EpisodeDetails,
|
||||
@@ -663,7 +663,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EpisodeDetails.into());
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = EpisodeDetailsHandler::with(
|
||||
let handler = EpisodeDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EpisodeDetails,
|
||||
@@ -679,7 +679,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EpisodeDetails.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = EpisodeDetailsHandler::with(
|
||||
let handler = EpisodeDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EpisodeDetails,
|
||||
@@ -703,7 +703,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EpisodeDetails.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = EpisodeDetailsHandler::with(
|
||||
let handler = EpisodeDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EpisodeDetails,
|
||||
@@ -730,7 +730,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::EpisodeHistory.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = EpisodeDetailsHandler::with(
|
||||
let handler = EpisodeDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::EpisodeHistory,
|
||||
@@ -757,7 +757,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::ManualEpisodeSearch.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = EpisodeDetailsHandler::with(
|
||||
let handler = EpisodeDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::ManualEpisodeSearch,
|
||||
@@ -784,7 +784,7 @@ mod tests {
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = EpisodeDetailsHandler::with(
|
||||
let handler = EpisodeDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -809,7 +809,7 @@ mod tests {
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = EpisodeDetailsHandler::with(
|
||||
let handler = EpisodeDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
|
||||
@@ -59,7 +59,7 @@ mod tests {
|
||||
.series
|
||||
.set_items(vec![Series::default()]);
|
||||
|
||||
LibraryHandler::with(DELETE_KEY, &mut app, ActiveSonarrBlock::Series, None).handle();
|
||||
LibraryHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::Series, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
}
|
||||
@@ -77,7 +77,7 @@ mod tests {
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(0);
|
||||
|
||||
LibraryHandler::with(
|
||||
LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Series,
|
||||
@@ -98,7 +98,7 @@ mod tests {
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(0);
|
||||
|
||||
LibraryHandler::with(
|
||||
LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Series,
|
||||
@@ -120,7 +120,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
|
||||
LibraryHandler::with(
|
||||
LibraryHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::UpdateAllSeriesPrompt,
|
||||
@@ -130,7 +130,7 @@ mod tests {
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
|
||||
LibraryHandler::with(
|
||||
LibraryHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::UpdateAllSeriesPrompt,
|
||||
@@ -160,7 +160,7 @@ mod tests {
|
||||
.series
|
||||
.set_items(vec![Series::default()]);
|
||||
|
||||
LibraryHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Series, None).handle();
|
||||
LibraryHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Series, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -179,7 +179,7 @@ mod tests {
|
||||
.series
|
||||
.set_items(vec![Series::default()]);
|
||||
|
||||
LibraryHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Series, None).handle();
|
||||
LibraryHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::Series, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
}
|
||||
@@ -196,7 +196,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::UpdateAllSeriesPrompt.into());
|
||||
|
||||
LibraryHandler::with(
|
||||
LibraryHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::UpdateAllSeriesPrompt,
|
||||
@@ -223,7 +223,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::UpdateAllSeriesPrompt.into());
|
||||
|
||||
LibraryHandler::with(
|
||||
LibraryHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::UpdateAllSeriesPrompt,
|
||||
@@ -253,7 +253,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::UpdateAllSeriesPrompt.into());
|
||||
app.data.sonarr_data.prompt_confirm = true;
|
||||
|
||||
LibraryHandler::with(
|
||||
LibraryHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::UpdateAllSeriesPrompt,
|
||||
@@ -274,7 +274,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.data.sonarr_data = create_test_sonarr_data();
|
||||
|
||||
LibraryHandler::with(ESC_KEY, &mut app, ActiveSonarrBlock::Series, None).handle();
|
||||
LibraryHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::Series, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
@@ -304,7 +304,7 @@ mod tests {
|
||||
.series
|
||||
.set_items(vec![Series::default()]);
|
||||
|
||||
LibraryHandler::with(
|
||||
LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.add.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Series,
|
||||
@@ -331,7 +331,7 @@ mod tests {
|
||||
.series
|
||||
.set_items(vec![Series::default()]);
|
||||
|
||||
LibraryHandler::with(
|
||||
LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.add.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Series,
|
||||
@@ -364,7 +364,7 @@ mod tests {
|
||||
.series
|
||||
.set_items(vec![Series::default()]);
|
||||
|
||||
LibraryHandler::with(
|
||||
LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.edit.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Series,
|
||||
@@ -385,7 +385,7 @@ mod tests {
|
||||
.series
|
||||
.set_items(vec![Series::default()]);
|
||||
|
||||
LibraryHandler::with(
|
||||
LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Series,
|
||||
@@ -410,7 +410,7 @@ mod tests {
|
||||
.series
|
||||
.set_items(vec![Series::default()]);
|
||||
|
||||
LibraryHandler::with(
|
||||
LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Series,
|
||||
@@ -431,7 +431,7 @@ mod tests {
|
||||
.set_items(vec![Series::default()]);
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
|
||||
LibraryHandler::with(
|
||||
LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Series,
|
||||
@@ -454,7 +454,7 @@ mod tests {
|
||||
.set_items(vec![Series::default()]);
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
|
||||
LibraryHandler::with(
|
||||
LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Series,
|
||||
@@ -477,7 +477,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::UpdateAllSeriesPrompt.into());
|
||||
|
||||
LibraryHandler::with(
|
||||
LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::UpdateAllSeriesPrompt,
|
||||
@@ -832,7 +832,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = LibraryHandler::with(
|
||||
let handler = LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Series,
|
||||
@@ -847,7 +847,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = LibraryHandler::with(
|
||||
let handler = LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Series,
|
||||
@@ -867,7 +867,7 @@ mod tests {
|
||||
.series
|
||||
.set_items(vec![Series::default()]);
|
||||
|
||||
let handler = LibraryHandler::with(
|
||||
let handler = LibraryHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::Series,
|
||||
|
||||
@@ -64,27 +64,27 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for LibraryHandler<'a, '
|
||||
if !self.handle_series_table_events(series_table_handling_config) {
|
||||
match self.active_sonarr_block {
|
||||
_ if AddSeriesHandler::accepts(self.active_sonarr_block) => {
|
||||
AddSeriesHandler::with(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
AddSeriesHandler::new(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
.handle();
|
||||
}
|
||||
_ if DeleteSeriesHandler::accepts(self.active_sonarr_block) => {
|
||||
DeleteSeriesHandler::with(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
DeleteSeriesHandler::new(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
.handle();
|
||||
}
|
||||
_ if EditSeriesHandler::accepts(self.active_sonarr_block) => {
|
||||
EditSeriesHandler::with(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
EditSeriesHandler::new(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
.handle();
|
||||
}
|
||||
_ if SeriesDetailsHandler::accepts(self.active_sonarr_block) => {
|
||||
SeriesDetailsHandler::with(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
SeriesDetailsHandler::new(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
.handle();
|
||||
}
|
||||
_ if SeasonDetailsHandler::accepts(self.active_sonarr_block) => {
|
||||
SeasonDetailsHandler::with(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
SeasonDetailsHandler::new(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
.handle();
|
||||
}
|
||||
_ if EpisodeDetailsHandler::accepts(self.active_sonarr_block) => {
|
||||
EpisodeDetailsHandler::with(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
EpisodeDetailsHandler::new(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
.handle();
|
||||
}
|
||||
_ => self.handle_key_event(),
|
||||
@@ -102,7 +102,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for LibraryHandler<'a, '
|
||||
|| LIBRARY_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -140,7 +140,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for SeasonDetailsHandler
|
||||
SEASON_DETAILS_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -34,7 +34,7 @@ mod tests {
|
||||
app.data.sonarr_data = create_test_sonarr_data();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonDetails.into());
|
||||
|
||||
SeasonDetailsHandler::with(DELETE_KEY, &mut app, ActiveSonarrBlock::SeasonDetails, None)
|
||||
SeasonDetailsHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::SeasonDetails, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -49,7 +49,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonDetails.into());
|
||||
app.is_loading = true;
|
||||
|
||||
SeasonDetailsHandler::with(DELETE_KEY, &mut app, ActiveSonarrBlock::SeasonDetails, None)
|
||||
SeasonDetailsHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::SeasonDetails, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -78,11 +78,11 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonDetails.into());
|
||||
|
||||
SeasonDetailsHandler::with(key, &mut app, active_sonarr_block, None).handle();
|
||||
SeasonDetailsHandler::new(key, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
|
||||
SeasonDetailsHandler::with(key, &mut app, active_sonarr_block, None).handle();
|
||||
SeasonDetailsHandler::new(key, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
@@ -126,7 +126,7 @@ mod tests {
|
||||
.position(|tab_route| tab_route.route == right_block.into())
|
||||
.unwrap_or_default();
|
||||
|
||||
SeasonDetailsHandler::with(DEFAULT_KEYBINDINGS.left.key, &mut app, right_block, None)
|
||||
SeasonDetailsHandler::new(DEFAULT_KEYBINDINGS.left.key, &mut app, right_block, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -142,7 +142,7 @@ mod tests {
|
||||
);
|
||||
assert_eq!(app.get_current_route(), left_block.into());
|
||||
|
||||
SeasonDetailsHandler::with(DEFAULT_KEYBINDINGS.right.key, &mut app, left_block, None)
|
||||
SeasonDetailsHandler::new(DEFAULT_KEYBINDINGS.right.key, &mut app, left_block, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -175,7 +175,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonDetails.into());
|
||||
app.data.sonarr_data = create_test_sonarr_data();
|
||||
|
||||
SeasonDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeasonDetails, None)
|
||||
SeasonDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeasonDetails, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -197,7 +197,7 @@ mod tests {
|
||||
.episodes = StatefulTable::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonDetails.into());
|
||||
|
||||
SeasonDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeasonDetails, None)
|
||||
SeasonDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeasonDetails, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -212,7 +212,7 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonDetails.into());
|
||||
|
||||
SeasonDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeasonDetails, None)
|
||||
SeasonDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeasonDetails, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -226,7 +226,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.data.sonarr_data = create_test_sonarr_data();
|
||||
|
||||
SeasonDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeasonHistory, None)
|
||||
SeasonDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeasonHistory, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -248,7 +248,7 @@ mod tests {
|
||||
.season_history = StatefulTable::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonHistory.into());
|
||||
|
||||
SeasonDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeasonHistory, None)
|
||||
SeasonDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeasonHistory, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -264,7 +264,7 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonHistory.into());
|
||||
|
||||
SeasonDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeasonHistory, None)
|
||||
SeasonDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeasonHistory, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -294,7 +294,7 @@ mod tests {
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
SeasonDetailsHandler::with(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
SeasonDetailsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(app.get_current_route(), active_sonarr_block.into());
|
||||
@@ -312,7 +312,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::ManualSeasonSearch.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::ManualSeasonSearchConfirmPrompt.into());
|
||||
|
||||
SeasonDetailsHandler::with(
|
||||
SeasonDetailsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::ManualSeasonSearchConfirmPrompt,
|
||||
@@ -351,7 +351,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonDetails.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
SeasonDetailsHandler::with(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
SeasonDetailsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
@@ -367,7 +367,7 @@ mod tests {
|
||||
app.data.sonarr_data = create_test_sonarr_data();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::ManualSeasonSearch.into());
|
||||
|
||||
SeasonDetailsHandler::with(
|
||||
SeasonDetailsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::ManualSeasonSearch,
|
||||
@@ -388,7 +388,7 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::ManualSeasonSearch.into());
|
||||
|
||||
SeasonDetailsHandler::with(
|
||||
SeasonDetailsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::ManualSeasonSearch,
|
||||
@@ -420,7 +420,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonHistory.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonHistoryDetails.into());
|
||||
|
||||
SeasonDetailsHandler::with(
|
||||
SeasonDetailsHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeasonHistoryDetails,
|
||||
@@ -451,7 +451,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonDetails.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
SeasonDetailsHandler::with(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
SeasonDetailsHandler::new(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
@@ -481,7 +481,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeriesDetails.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonHistory.into());
|
||||
|
||||
SeasonDetailsHandler::with(ESC_KEY, &mut app, ActiveSonarrBlock::SeasonHistory, None)
|
||||
SeasonDetailsHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::SeasonHistory, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -531,7 +531,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeriesDetails.into());
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
SeasonDetailsHandler::with(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
SeasonDetailsHandler::new(ESC_KEY, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -562,7 +562,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonDetails.into());
|
||||
app.is_routing = false;
|
||||
|
||||
SeasonDetailsHandler::with(
|
||||
SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.toggle_monitoring.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeasonDetails,
|
||||
@@ -589,7 +589,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonDetails.into());
|
||||
app.is_routing = false;
|
||||
|
||||
SeasonDetailsHandler::with(
|
||||
SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.toggle_monitoring.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeasonDetails,
|
||||
@@ -619,7 +619,7 @@ mod tests {
|
||||
app.data.sonarr_data = create_test_sonarr_data();
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
SeasonDetailsHandler::with(
|
||||
SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.auto_search.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -646,7 +646,7 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
SeasonDetailsHandler::with(
|
||||
SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.auto_search.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -671,7 +671,7 @@ mod tests {
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
app.is_routing = false;
|
||||
|
||||
SeasonDetailsHandler::with(
|
||||
SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -698,7 +698,7 @@ mod tests {
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
app.is_routing = false;
|
||||
|
||||
SeasonDetailsHandler::with(
|
||||
SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -731,7 +731,7 @@ mod tests {
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
SeasonDetailsHandler::with(
|
||||
SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
prompt_block,
|
||||
@@ -755,7 +755,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::ManualSeasonSearch.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::ManualSeasonSearchConfirmPrompt.into());
|
||||
|
||||
SeasonDetailsHandler::with(
|
||||
SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::ManualSeasonSearchConfirmPrompt,
|
||||
@@ -797,7 +797,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.data.sonarr_data = create_test_sonarr_data();
|
||||
|
||||
let episode_file_id = SeasonDetailsHandler::with(
|
||||
let episode_file_id = SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeasonDetails,
|
||||
@@ -813,7 +813,7 @@ mod tests {
|
||||
fn test_extract_episode_file_id_empty_season_details_modal_panics() {
|
||||
let mut app = App::default();
|
||||
|
||||
SeasonDetailsHandler::with(
|
||||
SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeasonDetails,
|
||||
@@ -829,7 +829,7 @@ mod tests {
|
||||
season_details_modal.episodes.set_items(vec![episode()]);
|
||||
app.data.sonarr_data.season_details_modal = Some(season_details_modal);
|
||||
|
||||
let episode_id = SeasonDetailsHandler::with(
|
||||
let episode_id = SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeasonDetails,
|
||||
@@ -845,7 +845,7 @@ mod tests {
|
||||
fn test_extract_episode_id_panic_when_season_details_modal_is_none() {
|
||||
let mut app = App::default();
|
||||
|
||||
SeasonDetailsHandler::with(
|
||||
SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeasonDetails,
|
||||
@@ -859,7 +859,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.data.sonarr_data = create_test_sonarr_data();
|
||||
|
||||
let (series_id, season_number) = SeasonDetailsHandler::with(
|
||||
let (series_id, season_number) = SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeasonDetails,
|
||||
@@ -877,7 +877,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonDetails.into());
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = SeasonDetailsHandler::with(
|
||||
let handler = SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeasonDetails,
|
||||
@@ -892,7 +892,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonDetails.into());
|
||||
|
||||
let handler = SeasonDetailsHandler::with(
|
||||
let handler = SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeasonDetails,
|
||||
@@ -908,7 +908,7 @@ mod tests {
|
||||
app.data.sonarr_data.season_details_modal = Some(SeasonDetailsModal::default());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonDetails.into());
|
||||
|
||||
let handler = SeasonDetailsHandler::with(
|
||||
let handler = SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeasonDetails,
|
||||
@@ -924,7 +924,7 @@ mod tests {
|
||||
app.data.sonarr_data.season_details_modal = Some(SeasonDetailsModal::default());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeasonHistory.into());
|
||||
|
||||
let handler = SeasonDetailsHandler::with(
|
||||
let handler = SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeasonHistory,
|
||||
@@ -940,7 +940,7 @@ mod tests {
|
||||
app.data.sonarr_data.season_details_modal = Some(SeasonDetailsModal::default());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::ManualSeasonSearch.into());
|
||||
|
||||
let handler = SeasonDetailsHandler::with(
|
||||
let handler = SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::ManualSeasonSearch,
|
||||
@@ -964,7 +964,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeriesDetails.into());
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
let handler = SeasonDetailsHandler::with(
|
||||
let handler = SeasonDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
|
||||
@@ -91,7 +91,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for SeriesDetailsHandler
|
||||
SERIES_DETAILS_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -33,11 +33,11 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
|
||||
SeriesDetailsHandler::with(key, &mut app, active_sonarr_block, None).handle();
|
||||
SeriesDetailsHandler::new(key, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
|
||||
SeriesDetailsHandler::with(key, &mut app, active_sonarr_block, None).handle();
|
||||
SeriesDetailsHandler::new(key, &mut app, active_sonarr_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ mod tests {
|
||||
.position(|tab_route| tab_route.route == right_block.into())
|
||||
.unwrap_or_default();
|
||||
|
||||
SeriesDetailsHandler::with(DEFAULT_KEYBINDINGS.left.key, &mut app, right_block, None)
|
||||
SeriesDetailsHandler::new(DEFAULT_KEYBINDINGS.left.key, &mut app, right_block, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -72,7 +72,7 @@ mod tests {
|
||||
);
|
||||
assert_eq!(app.get_current_route(), left_block.into());
|
||||
|
||||
SeriesDetailsHandler::with(DEFAULT_KEYBINDINGS.right.key, &mut app, left_block, None)
|
||||
SeriesDetailsHandler::new(DEFAULT_KEYBINDINGS.right.key, &mut app, left_block, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -102,7 +102,7 @@ mod tests {
|
||||
.seasons
|
||||
.set_items(extended_stateful_iterable_vec!(Season, Option));
|
||||
|
||||
SeriesDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeriesDetails, None)
|
||||
SeriesDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeriesDetails, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -116,7 +116,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeriesDetails.into());
|
||||
|
||||
SeriesDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeriesDetails, None)
|
||||
SeriesDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeriesDetails, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -131,7 +131,7 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
|
||||
SeriesDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeriesDetails, None)
|
||||
SeriesDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeriesDetails, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
@@ -144,7 +144,7 @@ mod tests {
|
||||
series_history.set_items(vec![SonarrHistoryItem::default()]);
|
||||
app.data.sonarr_data.series_history = Some(series_history);
|
||||
|
||||
SeriesDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeriesHistory, None)
|
||||
SeriesDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeriesHistory, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -159,7 +159,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeriesHistory.into());
|
||||
app.data.sonarr_data.series_history = Some(StatefulTable::default());
|
||||
|
||||
SeriesDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeriesHistory, None)
|
||||
SeriesDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeriesHistory, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -174,7 +174,7 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
|
||||
SeriesDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeriesHistory, None)
|
||||
SeriesDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SeriesHistory, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::Series.into());
|
||||
@@ -199,7 +199,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeriesDetails.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
SeriesDetailsHandler::with(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
SeriesDetailsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
@@ -224,7 +224,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeriesDetails.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
SeriesDetailsHandler::with(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
SeriesDetailsHandler::new(SUBMIT_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
@@ -249,7 +249,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeriesHistory.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeriesHistoryDetails.into());
|
||||
|
||||
SeriesDetailsHandler::with(
|
||||
SeriesDetailsHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeriesHistoryDetails,
|
||||
@@ -278,7 +278,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeriesDetails.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
SeriesDetailsHandler::with(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
SeriesDetailsHandler::new(ESC_KEY, &mut app, prompt_block, None).handle();
|
||||
|
||||
assert!(!app.data.sonarr_data.prompt_confirm);
|
||||
assert_eq!(
|
||||
@@ -300,7 +300,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeriesHistory.into());
|
||||
|
||||
SeriesDetailsHandler::with(ESC_KEY, &mut app, ActiveSonarrBlock::SeriesHistory, None)
|
||||
SeriesDetailsHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::SeriesHistory, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -366,7 +366,7 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
SeriesDetailsHandler::with(
|
||||
SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.edit.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -385,7 +385,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeriesDetails.into());
|
||||
app.is_routing = false;
|
||||
|
||||
SeriesDetailsHandler::with(
|
||||
SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.toggle_monitoring.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeriesDetails,
|
||||
@@ -412,7 +412,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SeriesDetails.into());
|
||||
app.is_routing = false;
|
||||
|
||||
SeriesDetailsHandler::with(
|
||||
SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.toggle_monitoring.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeriesDetails,
|
||||
@@ -440,7 +440,7 @@ mod tests {
|
||||
app.data.sonarr_data.series_history = Some(series_history);
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
SeriesDetailsHandler::with(
|
||||
SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.auto_search.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -463,7 +463,7 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
SeriesDetailsHandler::with(
|
||||
SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.auto_search.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -485,7 +485,7 @@ mod tests {
|
||||
app.data.sonarr_data.series_history = Some(series_history);
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
SeriesDetailsHandler::with(
|
||||
SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -508,7 +508,7 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
SeriesDetailsHandler::with(
|
||||
SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -531,7 +531,7 @@ mod tests {
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
app.is_routing = false;
|
||||
|
||||
SeriesDetailsHandler::with(
|
||||
SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -553,7 +553,7 @@ mod tests {
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
app.is_routing = false;
|
||||
|
||||
SeriesDetailsHandler::with(
|
||||
SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -586,7 +586,7 @@ mod tests {
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
app.push_navigation_stack(prompt_block.into());
|
||||
|
||||
SeriesDetailsHandler::with(
|
||||
SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
prompt_block,
|
||||
@@ -620,7 +620,7 @@ mod tests {
|
||||
app.data.sonarr_data.series.set_items(vec![series()]);
|
||||
app.data.sonarr_data.seasons.set_items(vec![season()]);
|
||||
|
||||
let series_id_season_number_tuple = SeriesDetailsHandler::with(
|
||||
let series_id_season_number_tuple = SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeriesDetails,
|
||||
@@ -636,7 +636,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.data.sonarr_data.series.set_items(vec![series()]);
|
||||
|
||||
let series_id = SeriesDetailsHandler::with(
|
||||
let series_id = SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeriesDetails,
|
||||
@@ -653,7 +653,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = SeriesDetailsHandler::with(
|
||||
let handler = SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeriesDetails,
|
||||
@@ -668,7 +668,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
|
||||
let handler = SeriesDetailsHandler::with(
|
||||
let handler = SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeriesHistory,
|
||||
@@ -684,7 +684,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
app.data.sonarr_data.series_history = Some(StatefulTable::default());
|
||||
|
||||
let handler = SeriesDetailsHandler::with(
|
||||
let handler = SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeriesHistory,
|
||||
@@ -699,7 +699,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::Series.into());
|
||||
|
||||
let handler = SeriesDetailsHandler::with(
|
||||
let handler = SeriesDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SeriesDetails,
|
||||
|
||||
@@ -41,26 +41,26 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for SonarrHandler<'a, 'b
|
||||
fn handle(&mut self) {
|
||||
match self.active_sonarr_block {
|
||||
_ if LibraryHandler::accepts(self.active_sonarr_block) => {
|
||||
LibraryHandler::with(self.key, self.app, self.active_sonarr_block, self.context).handle();
|
||||
LibraryHandler::new(self.key, self.app, self.active_sonarr_block, self.context).handle();
|
||||
}
|
||||
_ if DownloadsHandler::accepts(self.active_sonarr_block) => {
|
||||
DownloadsHandler::with(self.key, self.app, self.active_sonarr_block, self.context).handle()
|
||||
DownloadsHandler::new(self.key, self.app, self.active_sonarr_block, self.context).handle()
|
||||
}
|
||||
_ if BlocklistHandler::accepts(self.active_sonarr_block) => {
|
||||
BlocklistHandler::with(self.key, self.app, self.active_sonarr_block, self.context).handle()
|
||||
BlocklistHandler::new(self.key, self.app, self.active_sonarr_block, self.context).handle()
|
||||
}
|
||||
_ if HistoryHandler::accepts(self.active_sonarr_block) => {
|
||||
HistoryHandler::with(self.key, self.app, self.active_sonarr_block, self.context).handle()
|
||||
HistoryHandler::new(self.key, self.app, self.active_sonarr_block, self.context).handle()
|
||||
}
|
||||
_ if RootFoldersHandler::accepts(self.active_sonarr_block) => {
|
||||
RootFoldersHandler::with(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
RootFoldersHandler::new(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
.handle()
|
||||
}
|
||||
_ if IndexersHandler::accepts(self.active_sonarr_block) => {
|
||||
IndexersHandler::with(self.key, self.app, self.active_sonarr_block, self.context).handle()
|
||||
IndexersHandler::new(self.key, self.app, self.active_sonarr_block, self.context).handle()
|
||||
}
|
||||
_ if SystemHandler::accepts(self.active_sonarr_block) => {
|
||||
SystemHandler::with(self.key, self.app, self.active_sonarr_block, self.context).handle()
|
||||
SystemHandler::new(self.key, self.app, self.active_sonarr_block, self.context).handle()
|
||||
}
|
||||
_ => self.handle_key_event(),
|
||||
}
|
||||
@@ -70,7 +70,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for SonarrHandler<'a, 'b
|
||||
true
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -68,7 +68,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for RootFoldersHandler<'
|
||||
ROOT_FOLDERS_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -32,7 +32,7 @@ mod tests {
|
||||
.set_items(vec![RootFolder::default()]);
|
||||
app.data.sonarr_data.edit_root_folder = Some("Test".into());
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddRootFolderPrompt,
|
||||
@@ -52,7 +52,7 @@ mod tests {
|
||||
4
|
||||
);
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddRootFolderPrompt,
|
||||
@@ -91,7 +91,7 @@ mod tests {
|
||||
.root_folders
|
||||
.set_items(vec![RootFolder::default()]);
|
||||
|
||||
RootFoldersHandler::with(DELETE_KEY, &mut app, ActiveSonarrBlock::RootFolders, None).handle();
|
||||
RootFoldersHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::RootFolders, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -110,7 +110,7 @@ mod tests {
|
||||
.root_folders
|
||||
.set_items(vec![RootFolder::default()]);
|
||||
|
||||
RootFoldersHandler::with(DELETE_KEY, &mut app, ActiveSonarrBlock::RootFolders, None).handle();
|
||||
RootFoldersHandler::new(DELETE_KEY, &mut app, ActiveSonarrBlock::RootFolders, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -134,7 +134,7 @@ mod tests {
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(4);
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::RootFolders,
|
||||
@@ -156,7 +156,7 @@ mod tests {
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(4);
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::RootFolders,
|
||||
@@ -178,7 +178,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::RootFolders.into());
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteRootFolderPrompt,
|
||||
@@ -188,7 +188,7 @@ mod tests {
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteRootFolderPrompt,
|
||||
@@ -205,7 +205,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::RootFolders.into());
|
||||
app.data.sonarr_data.edit_root_folder = Some("Test".into());
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddRootFolderPrompt,
|
||||
@@ -225,7 +225,7 @@ mod tests {
|
||||
1
|
||||
);
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddRootFolderPrompt,
|
||||
@@ -273,7 +273,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::RootFolders.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddRootFolderPrompt.into());
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddRootFolderPrompt,
|
||||
@@ -303,7 +303,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::RootFolders.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::AddRootFolderPrompt.into());
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddRootFolderPrompt,
|
||||
@@ -332,7 +332,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::RootFolders.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::DeleteRootFolderPrompt.into());
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteRootFolderPrompt,
|
||||
@@ -362,7 +362,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::RootFolders.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::DeleteRootFolderPrompt.into());
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteRootFolderPrompt,
|
||||
@@ -393,7 +393,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::DeleteRootFolderPrompt.into());
|
||||
app.data.sonarr_data.prompt_confirm = true;
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteRootFolderPrompt,
|
||||
@@ -416,7 +416,7 @@ mod tests {
|
||||
app.data.sonarr_data.edit_root_folder = Some("/nfs/test".into());
|
||||
app.should_ignore_quit_key = true;
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddRootFolderPrompt,
|
||||
@@ -442,7 +442,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::RootFolders.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::RootFolders.into());
|
||||
|
||||
RootFoldersHandler::with(ESC_KEY, &mut app, ActiveSonarrBlock::RootFolders, None).handle();
|
||||
RootFoldersHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::RootFolders, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
@@ -469,7 +469,7 @@ mod tests {
|
||||
.root_folders
|
||||
.set_items(vec![RootFolder::default()]);
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.add.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::RootFolders,
|
||||
@@ -496,7 +496,7 @@ mod tests {
|
||||
.root_folders
|
||||
.set_items(vec![RootFolder::default()]);
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.add.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::RootFolders,
|
||||
@@ -522,7 +522,7 @@ mod tests {
|
||||
.set_items(vec![RootFolder::default()]);
|
||||
app.push_navigation_stack(ActiveSonarrBlock::RootFolders.into());
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::RootFolders,
|
||||
@@ -548,7 +548,7 @@ mod tests {
|
||||
.set_items(vec![RootFolder::default()]);
|
||||
app.push_navigation_stack(ActiveSonarrBlock::RootFolders.into());
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::RootFolders,
|
||||
@@ -574,7 +574,7 @@ mod tests {
|
||||
.set_items(vec![RootFolder::default()]);
|
||||
app.data.sonarr_data.edit_root_folder = Some("/nfs/test".into());
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.backspace.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddRootFolderPrompt,
|
||||
@@ -599,7 +599,7 @@ mod tests {
|
||||
.set_items(vec![RootFolder::default()]);
|
||||
app.data.sonarr_data.edit_root_folder = Some(HorizontallyScrollableText::default());
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
Key::Char('h'),
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddRootFolderPrompt,
|
||||
@@ -624,7 +624,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::RootFolders.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::DeleteRootFolderPrompt.into());
|
||||
|
||||
RootFoldersHandler::with(
|
||||
RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteRootFolderPrompt,
|
||||
@@ -664,7 +664,7 @@ mod tests {
|
||||
.root_folders
|
||||
.set_items(vec![root_folder()]);
|
||||
|
||||
let root_folder_id = RootFoldersHandler::with(
|
||||
let root_folder_id = RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::DeleteRootFolderPrompt,
|
||||
@@ -683,7 +683,7 @@ mod tests {
|
||||
path: "/nfs/test".to_owned(),
|
||||
};
|
||||
|
||||
let root_folder = RootFoldersHandler::with(
|
||||
let root_folder = RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::AddRootFolderPrompt,
|
||||
@@ -701,7 +701,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::RootFolders.into());
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = RootFoldersHandler::with(
|
||||
let handler = RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::RootFolders,
|
||||
@@ -717,7 +717,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::RootFolders.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = RootFoldersHandler::with(
|
||||
let handler = RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::RootFolders,
|
||||
@@ -738,7 +738,7 @@ mod tests {
|
||||
.sonarr_data
|
||||
.root_folders
|
||||
.set_items(vec![RootFolder::default()]);
|
||||
let handler = RootFoldersHandler::with(
|
||||
let handler = RootFoldersHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::RootFolders,
|
||||
|
||||
@@ -41,7 +41,7 @@ pub(in crate::handlers::sonarr_handlers) mod utils {
|
||||
}]);
|
||||
app.data.sonarr_data = sonarr_data;
|
||||
|
||||
$handler::with(DEFAULT_KEYBINDINGS.edit.key, &mut app, $block, None).handle();
|
||||
$handler::new(DEFAULT_KEYBINDINGS.edit.key, &mut app, $block, None).handle();
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
|
||||
@@ -24,7 +24,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for SystemHandler<'a, 'b
|
||||
fn handle(&mut self) {
|
||||
match self.active_sonarr_block {
|
||||
_ if SystemDetailsHandler::accepts(self.active_sonarr_block) => {
|
||||
SystemDetailsHandler::with(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
SystemDetailsHandler::new(self.key, self.app, self.active_sonarr_block, self.context)
|
||||
.handle()
|
||||
}
|
||||
_ => self.handle_key_event(),
|
||||
@@ -35,7 +35,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for SystemHandler<'a, 'b
|
||||
SystemDetailsHandler::accepts(active_block) || active_block == ActiveSonarrBlock::System
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -36,7 +36,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveSonarrBlock> for SystemDetailsHandler
|
||||
SYSTEM_DETAILS_BLOCKS.contains(&active_block)
|
||||
}
|
||||
|
||||
fn with(
|
||||
fn new(
|
||||
key: Key,
|
||||
app: &'a mut App<'b>,
|
||||
active_block: ActiveSonarrBlock,
|
||||
|
||||
@@ -52,14 +52,14 @@ mod tests {
|
||||
text
|
||||
));
|
||||
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveSonarrBlock::SystemLogs, None).handle();
|
||||
SystemDetailsHandler::new(key, &mut app, ActiveSonarrBlock::SystemLogs, None).handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.sonarr_data.log_details.current_selection().text,
|
||||
"Test 1"
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveSonarrBlock::SystemLogs, None).handle();
|
||||
SystemDetailsHandler::new(key, &mut app, ActiveSonarrBlock::SystemLogs, None).handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.sonarr_data.log_details.current_selection().text,
|
||||
@@ -80,14 +80,14 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(simple_stateful_iterable_vec!(SonarrTask, String, name));
|
||||
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveSonarrBlock::SystemTasks, None).handle();
|
||||
SystemDetailsHandler::new(key, &mut app, ActiveSonarrBlock::SystemTasks, None).handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.sonarr_data.tasks.current_selection().name,
|
||||
"Test 2"
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveSonarrBlock::SystemTasks, None).handle();
|
||||
SystemDetailsHandler::new(key, &mut app, ActiveSonarrBlock::SystemTasks, None).handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.sonarr_data.tasks.current_selection().name,
|
||||
@@ -109,14 +109,14 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(simple_stateful_iterable_vec!(SonarrTask, String, name));
|
||||
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveSonarrBlock::SystemTasks, None).handle();
|
||||
SystemDetailsHandler::new(key, &mut app, ActiveSonarrBlock::SystemTasks, None).handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.sonarr_data.tasks.current_selection().name,
|
||||
"Test 1"
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveSonarrBlock::SystemTasks, None).handle();
|
||||
SystemDetailsHandler::new(key, &mut app, ActiveSonarrBlock::SystemTasks, None).handle();
|
||||
|
||||
assert_str_eq!(
|
||||
app.data.sonarr_data.tasks.current_selection().name,
|
||||
@@ -137,7 +137,7 @@ mod tests {
|
||||
.queued_events
|
||||
.set_items(simple_stateful_iterable_vec!(QueueEvent, String, name));
|
||||
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveSonarrBlock::SystemQueuedEvents, None)
|
||||
SystemDetailsHandler::new(key, &mut app, ActiveSonarrBlock::SystemQueuedEvents, None)
|
||||
.handle();
|
||||
|
||||
assert_str_eq!(
|
||||
@@ -145,7 +145,7 @@ mod tests {
|
||||
"Test 2"
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveSonarrBlock::SystemQueuedEvents, None)
|
||||
SystemDetailsHandler::new(key, &mut app, ActiveSonarrBlock::SystemQueuedEvents, None)
|
||||
.handle();
|
||||
|
||||
assert_str_eq!(
|
||||
@@ -168,7 +168,7 @@ mod tests {
|
||||
.queued_events
|
||||
.set_items(simple_stateful_iterable_vec!(QueueEvent, String, name));
|
||||
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveSonarrBlock::SystemQueuedEvents, None)
|
||||
SystemDetailsHandler::new(key, &mut app, ActiveSonarrBlock::SystemQueuedEvents, None)
|
||||
.handle();
|
||||
|
||||
assert_str_eq!(
|
||||
@@ -176,7 +176,7 @@ mod tests {
|
||||
"Test 1"
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(key, &mut app, ActiveSonarrBlock::SystemQueuedEvents, None)
|
||||
SystemDetailsHandler::new(key, &mut app, ActiveSonarrBlock::SystemQueuedEvents, None)
|
||||
.handle();
|
||||
|
||||
assert_str_eq!(
|
||||
@@ -191,7 +191,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.up.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemUpdates,
|
||||
@@ -201,7 +201,7 @@ mod tests {
|
||||
|
||||
assert_eq!(app.data.sonarr_data.updates.offset, 0);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.down.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemUpdates,
|
||||
@@ -219,7 +219,7 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.up.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemUpdates,
|
||||
@@ -229,7 +229,7 @@ mod tests {
|
||||
|
||||
assert_eq!(app.data.sonarr_data.updates.offset, 0);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.down.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemUpdates,
|
||||
@@ -274,7 +274,7 @@ mod tests {
|
||||
text
|
||||
));
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemLogs,
|
||||
@@ -287,7 +287,7 @@ mod tests {
|
||||
"Test 1"
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemLogs,
|
||||
@@ -313,7 +313,7 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(extended_stateful_iterable_vec!(SonarrTask, String, name));
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemTasks,
|
||||
@@ -326,7 +326,7 @@ mod tests {
|
||||
"Test 3"
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemTasks,
|
||||
@@ -353,7 +353,7 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(extended_stateful_iterable_vec!(SonarrTask, String, name));
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemTasks,
|
||||
@@ -366,7 +366,7 @@ mod tests {
|
||||
"Test 1"
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemTasks,
|
||||
@@ -392,7 +392,7 @@ mod tests {
|
||||
.queued_events
|
||||
.set_items(extended_stateful_iterable_vec!(QueueEvent, String, name));
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemQueuedEvents,
|
||||
@@ -405,7 +405,7 @@ mod tests {
|
||||
"Test 3"
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemQueuedEvents,
|
||||
@@ -432,7 +432,7 @@ mod tests {
|
||||
.queued_events
|
||||
.set_items(extended_stateful_iterable_vec!(QueueEvent, String, name));
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemQueuedEvents,
|
||||
@@ -445,7 +445,7 @@ mod tests {
|
||||
"Test 1"
|
||||
);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemQueuedEvents,
|
||||
@@ -465,7 +465,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemUpdates,
|
||||
@@ -475,7 +475,7 @@ mod tests {
|
||||
|
||||
assert_eq!(app.data.sonarr_data.updates.offset, 1);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemUpdates,
|
||||
@@ -493,7 +493,7 @@ mod tests {
|
||||
app.is_loading = true;
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test 1\nTest 2".to_owned());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.end.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemUpdates,
|
||||
@@ -503,7 +503,7 @@ mod tests {
|
||||
|
||||
assert_eq!(app.data.sonarr_data.updates.offset, 0);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.home.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemUpdates,
|
||||
@@ -532,7 +532,7 @@ mod tests {
|
||||
.log_details
|
||||
.set_items(vec!["t1".into(), "t22".into()]);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -543,7 +543,7 @@ mod tests {
|
||||
assert_eq!(app.data.sonarr_data.log_details.items[0].to_string(), "t1");
|
||||
assert_eq!(app.data.sonarr_data.log_details.items[1].to_string(), "t22");
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -554,7 +554,7 @@ mod tests {
|
||||
assert_eq!(app.data.sonarr_data.log_details.items[0].to_string(), "1");
|
||||
assert_eq!(app.data.sonarr_data.log_details.items[1].to_string(), "22");
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -565,7 +565,7 @@ mod tests {
|
||||
assert_eq!(app.data.sonarr_data.log_details.items[0].to_string(), "");
|
||||
assert_eq!(app.data.sonarr_data.log_details.items[1].to_string(), "2");
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -576,7 +576,7 @@ mod tests {
|
||||
assert_eq!(app.data.sonarr_data.log_details.items[0].to_string(), "");
|
||||
assert_eq!(app.data.sonarr_data.log_details.items[1].to_string(), "");
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -587,7 +587,7 @@ mod tests {
|
||||
assert_eq!(app.data.sonarr_data.log_details.items[0].to_string(), "");
|
||||
assert_eq!(app.data.sonarr_data.log_details.items[1].to_string(), "");
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -598,7 +598,7 @@ mod tests {
|
||||
assert_eq!(app.data.sonarr_data.log_details.items[0].to_string(), "1");
|
||||
assert_eq!(app.data.sonarr_data.log_details.items[1].to_string(), "2");
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -609,7 +609,7 @@ mod tests {
|
||||
assert_eq!(app.data.sonarr_data.log_details.items[0].to_string(), "t1");
|
||||
assert_eq!(app.data.sonarr_data.log_details.items[1].to_string(), "22");
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -628,7 +628,7 @@ mod tests {
|
||||
let mut app = App::default();
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemTaskStartConfirmPrompt,
|
||||
@@ -638,7 +638,7 @@ mod tests {
|
||||
|
||||
assert!(app.data.sonarr_data.prompt_confirm);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemTaskStartConfirmPrompt,
|
||||
@@ -665,7 +665,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
|
||||
SystemDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SystemTasks, None)
|
||||
SystemDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SystemTasks, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -681,7 +681,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemTasks.into());
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
|
||||
SystemDetailsHandler::with(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SystemTasks, None)
|
||||
SystemDetailsHandler::new(SUBMIT_KEY, &mut app, ActiveSonarrBlock::SystemTasks, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(
|
||||
@@ -703,7 +703,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemTasks.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemTaskStartConfirmPrompt.into());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemTaskStartConfirmPrompt,
|
||||
@@ -729,7 +729,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemTasks.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemTaskStartConfirmPrompt.into());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
SUBMIT_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemTaskStartConfirmPrompt,
|
||||
@@ -772,7 +772,7 @@ mod tests {
|
||||
.log_details
|
||||
.set_items(vec![HorizontallyScrollableText::default()]);
|
||||
|
||||
SystemDetailsHandler::with(ESC_KEY, &mut app, ActiveSonarrBlock::SystemLogs, None).handle();
|
||||
SystemDetailsHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::SystemLogs, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::System.into());
|
||||
assert!(app.data.sonarr_data.log_details.items.is_empty());
|
||||
@@ -790,7 +790,7 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(vec![SonarrTask::default()]);
|
||||
|
||||
SystemDetailsHandler::with(ESC_KEY, &mut app, ActiveSonarrBlock::SystemTasks, None).handle();
|
||||
SystemDetailsHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::SystemTasks, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::System.into());
|
||||
}
|
||||
@@ -807,7 +807,7 @@ mod tests {
|
||||
.queued_events
|
||||
.set_items(vec![QueueEvent::default()]);
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemQueuedEvents,
|
||||
@@ -825,7 +825,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemUpdates.into());
|
||||
|
||||
SystemDetailsHandler::with(ESC_KEY, &mut app, ActiveSonarrBlock::SystemUpdates, None)
|
||||
SystemDetailsHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::SystemUpdates, None)
|
||||
.handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::System.into());
|
||||
@@ -838,7 +838,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemTaskStartConfirmPrompt.into());
|
||||
app.data.sonarr_data.prompt_confirm = true;
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
ESC_KEY,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemTaskStartConfirmPrompt,
|
||||
@@ -877,7 +877,7 @@ mod tests {
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -905,7 +905,7 @@ mod tests {
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
app.push_navigation_stack(active_sonarr_block.into());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
active_sonarr_block,
|
||||
@@ -930,7 +930,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemTasks.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::SystemTaskStartConfirmPrompt.into());
|
||||
|
||||
SystemDetailsHandler::with(
|
||||
SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.confirm.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemTaskStartConfirmPrompt,
|
||||
@@ -970,7 +970,7 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(vec![SonarrTask::default()]);
|
||||
|
||||
let task_name = SystemDetailsHandler::with(
|
||||
let task_name = SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemTasks,
|
||||
@@ -987,7 +987,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = true;
|
||||
|
||||
let handler = SystemDetailsHandler::with(
|
||||
let handler = SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemUpdates,
|
||||
@@ -1003,7 +1003,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = false;
|
||||
|
||||
let handler = SystemDetailsHandler::with(
|
||||
let handler = SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemUpdates,
|
||||
@@ -1024,7 +1024,7 @@ mod tests {
|
||||
.log_details
|
||||
.set_items(vec![HorizontallyScrollableText::default()]);
|
||||
|
||||
let handler = SystemDetailsHandler::with(
|
||||
let handler = SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemUpdates,
|
||||
@@ -1045,7 +1045,7 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(vec![SonarrTask::default()]);
|
||||
|
||||
let handler = SystemDetailsHandler::with(
|
||||
let handler = SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemTasks,
|
||||
@@ -1062,7 +1062,7 @@ mod tests {
|
||||
app.is_loading = false;
|
||||
app.data.sonarr_data.updates = ScrollableText::with_string("Test".to_owned());
|
||||
|
||||
let handler = SystemDetailsHandler::with(
|
||||
let handler = SystemDetailsHandler::new(
|
||||
DEFAULT_KEYBINDINGS.esc.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::SystemUpdates,
|
||||
|
||||
@@ -27,7 +27,7 @@ mod tests {
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(6);
|
||||
|
||||
SystemHandler::with(
|
||||
SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.left.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -49,7 +49,7 @@ mod tests {
|
||||
app.is_loading = is_ready;
|
||||
app.data.sonarr_data.main_tabs.set_index(6);
|
||||
|
||||
SystemHandler::with(
|
||||
SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.right.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -80,7 +80,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
|
||||
SystemHandler::with(ESC_KEY, &mut app, ActiveSonarrBlock::System, None).handle();
|
||||
SystemHandler::new(ESC_KEY, &mut app, ActiveSonarrBlock::System, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveSonarrBlock::System.into());
|
||||
assert!(app.error.text.is_empty());
|
||||
@@ -113,7 +113,7 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(vec![SonarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -147,7 +147,7 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(vec![SonarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -177,7 +177,7 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(vec![SonarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.events.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -211,7 +211,7 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(vec![SonarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.events.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -241,7 +241,7 @@ mod tests {
|
||||
.set_items(vec![SonarrTask::default()]);
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
|
||||
SystemHandler::with(
|
||||
SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -274,7 +274,7 @@ mod tests {
|
||||
.set_items(vec![SonarrTask::default()]);
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
|
||||
SystemHandler::with(
|
||||
SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.refresh.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -305,7 +305,7 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(vec![SonarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.logs.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -347,7 +347,7 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(vec![SonarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.logs.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -378,7 +378,7 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(vec![SonarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.tasks.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -412,7 +412,7 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(vec![SonarrTask::default()]);
|
||||
|
||||
SystemHandler::with(
|
||||
SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.tasks.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -462,7 +462,7 @@ mod tests {
|
||||
app.push_navigation_stack(ActiveSonarrBlock::System.into());
|
||||
app.is_loading = true;
|
||||
|
||||
let system_handler = SystemHandler::with(
|
||||
let system_handler = SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -488,7 +488,7 @@ mod tests {
|
||||
.queued_events
|
||||
.set_items(vec![QueueEvent::default()]);
|
||||
|
||||
let system_handler = SystemHandler::with(
|
||||
let system_handler = SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -510,7 +510,7 @@ mod tests {
|
||||
.queued_events
|
||||
.set_items(vec![QueueEvent::default()]);
|
||||
|
||||
let system_handler = SystemHandler::with(
|
||||
let system_handler = SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -532,7 +532,7 @@ mod tests {
|
||||
.tasks
|
||||
.set_items(vec![SonarrTask::default()]);
|
||||
|
||||
let system_handler = SystemHandler::with(
|
||||
let system_handler = SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
@@ -559,7 +559,7 @@ mod tests {
|
||||
.queued_events
|
||||
.set_items(vec![QueueEvent::default()]);
|
||||
|
||||
let system_handler = SystemHandler::with(
|
||||
let system_handler = SystemHandler::new(
|
||||
DEFAULT_KEYBINDINGS.update.key,
|
||||
&mut app,
|
||||
ActiveSonarrBlock::System,
|
||||
|
||||
Reference in New Issue
Block a user