refactor: Renamed KeyEventHandler::with to KeyEventHandler::new to keep with Rust best practices and conventions
This commit is contained in:
@@ -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