refactor(ui): Simplified the popup delegation so all future UI is easier to implement
This commit is contained in:
@@ -369,7 +369,7 @@ mod tests {
|
||||
test_edit_collection_key!(
|
||||
CollectionDetailsHandler,
|
||||
ActiveRadarrBlock::CollectionDetails,
|
||||
ActiveRadarrBlock::CollectionDetails
|
||||
Some(ActiveRadarrBlock::CollectionDetails)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -449,7 +449,11 @@ mod tests {
|
||||
#[test]
|
||||
fn test_collection_search_box_left_right_keys() {
|
||||
let mut app = App::default();
|
||||
app.data.radarr_data.collections.set_items(vec![Collection::default()]);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.collections
|
||||
.set_items(vec![Collection::default()]);
|
||||
app.push_navigation_stack(ActiveRadarrBlock::SearchCollection.into());
|
||||
app.data.radarr_data.collections.search = Some("Test".into());
|
||||
|
||||
@@ -499,7 +503,11 @@ mod tests {
|
||||
#[test]
|
||||
fn test_collection_filter_box_left_right_keys() {
|
||||
let mut app = App::default();
|
||||
app.data.radarr_data.collections.set_items(vec![Collection::default()]);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.collections
|
||||
.set_items(vec![Collection::default()]);
|
||||
app.push_navigation_stack(ActiveRadarrBlock::FilterCollections.into());
|
||||
app.data.radarr_data.collections.filter = Some("Test".into());
|
||||
|
||||
@@ -938,7 +946,11 @@ mod tests {
|
||||
filtered_state: Some(TableState::default()),
|
||||
..StatefulTable::default()
|
||||
};
|
||||
app.data.radarr_data.collections.set_items(vec![Collection::default()]);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.collections
|
||||
.set_items(vec![Collection::default()]);
|
||||
|
||||
CollectionsHandler::with(ESC_KEY, &mut app, active_radarr_block, None).handle();
|
||||
|
||||
@@ -977,7 +989,11 @@ mod tests {
|
||||
#[test]
|
||||
fn test_collections_sort_prompt_block_esc() {
|
||||
let mut app = App::default();
|
||||
app.data.radarr_data.collections.set_items(vec![Collection::default()]);
|
||||
app
|
||||
.data
|
||||
.radarr_data
|
||||
.collections
|
||||
.set_items(vec![Collection::default()]);
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Collections.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::CollectionsSortPrompt.into());
|
||||
|
||||
@@ -1174,11 +1190,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_collection_edit_key() {
|
||||
test_edit_collection_key!(
|
||||
CollectionsHandler,
|
||||
ActiveRadarrBlock::Collections,
|
||||
ActiveRadarrBlock::Collections
|
||||
);
|
||||
test_edit_collection_key!(CollectionsHandler, ActiveRadarrBlock::Collections, None);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -151,13 +151,9 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for CollectionsHandler<'
|
||||
match self.active_radarr_block {
|
||||
ActiveRadarrBlock::Collections => match self.key {
|
||||
_ if key == DEFAULT_KEYBINDINGS.edit.key => {
|
||||
self.app.push_navigation_stack(
|
||||
(
|
||||
ActiveRadarrBlock::EditCollectionPrompt,
|
||||
Some(ActiveRadarrBlock::Collections),
|
||||
)
|
||||
.into(),
|
||||
);
|
||||
self
|
||||
.app
|
||||
.push_navigation_stack(ActiveRadarrBlock::EditCollectionPrompt.into());
|
||||
self.app.data.radarr_data.edit_collection_modal =
|
||||
Some((&self.app.data.radarr_data).into());
|
||||
self.app.data.radarr_data.selected_block =
|
||||
|
||||
@@ -424,14 +424,14 @@ mod tests {
|
||||
fn test_test_indexer_esc(#[values(true, false)] is_ready: bool) {
|
||||
let mut app = App::default();
|
||||
app.is_loading = is_ready;
|
||||
app.data.radarr_data.indexer_test_error = Some("test result".to_owned());
|
||||
app.data.radarr_data.indexer_test_errors = Some("test result".to_owned());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::Indexers.into());
|
||||
app.push_navigation_stack(ActiveRadarrBlock::TestIndexer.into());
|
||||
|
||||
IndexersHandler::with(ESC_KEY, &mut app, ActiveRadarrBlock::TestIndexer, None).handle();
|
||||
|
||||
assert_eq!(app.get_current_route(), ActiveRadarrBlock::Indexers.into());
|
||||
assert_eq!(app.data.radarr_data.indexer_test_error, None);
|
||||
assert_eq!(app.data.radarr_data.indexer_test_errors, None);
|
||||
}
|
||||
|
||||
#[rstest]
|
||||
|
||||
@@ -154,7 +154,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveRadarrBlock> for IndexersHandler<'a,
|
||||
}
|
||||
ActiveRadarrBlock::TestIndexer => {
|
||||
self.app.pop_navigation_stack();
|
||||
self.app.data.radarr_data.indexer_test_error = None;
|
||||
self.app.data.radarr_data.indexer_test_errors = None;
|
||||
}
|
||||
_ => handle_clear_errors(self.app),
|
||||
}
|
||||
|
||||
@@ -141,7 +141,7 @@ mod utils {
|
||||
|
||||
assert_eq!(
|
||||
app.get_current_route(),
|
||||
(ActiveRadarrBlock::EditCollectionPrompt, Some($context)).into()
|
||||
(ActiveRadarrBlock::EditCollectionPrompt, $context).into()
|
||||
);
|
||||
assert_eq!(
|
||||
app.data.radarr_data.selected_block.get_active_block(),
|
||||
|
||||
Reference in New Issue
Block a user