fix(discovery): update page keybindings
This commit is contained in:
1 parent
1742f62cd0
commit
e14075ad8d
11 files changed
+87
-31
No files matched your search
+34
-2
@@ -2,6 +2,7 @@ use crossterm::event::{KeyCode, MouseEventKind};
|
||||
|
||||
use super::harness::UiHarness;
|
||||
use crate::instance::ProviderProject;
|
||||
use crate::net::modrinth::DiscoveryProject;
|
||||
use crate::tui::{
|
||||
app::{FocusedArea, ProviderConflictState},
|
||||
widgets::{
|
||||
@@ -58,6 +59,37 @@ fn discovery_mode_recovers_from_a_hidden_tab_and_cycles_visible_tabs() {
|
||||
assert_eq!(ui.app.content_tab, ContentTab::Mods);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn versions_open_from_a_discovery_project_page() {
|
||||
let mut ui = UiHarness::new();
|
||||
ui.add_instance("Test Instance");
|
||||
ui.app.focused = FocusedArea::Content;
|
||||
ui.app.content_mode = ContentMode::Discover;
|
||||
ui.app.content_tab = ContentTab::Mods;
|
||||
ui.app.mods_discovery_state.list.entries.push(
|
||||
crate::tui::widgets::content::discovery::provider_project_entry(
|
||||
DiscoveryProject {
|
||||
id: "project".to_owned(),
|
||||
slug: "project".to_owned(),
|
||||
title: "Project".to_owned(),
|
||||
description: String::new(),
|
||||
downloads: 0,
|
||||
icon_url: None,
|
||||
icon_bytes: None,
|
||||
},
|
||||
"modrinth",
|
||||
"project".to_owned(),
|
||||
None,
|
||||
),
|
||||
);
|
||||
ui.app.mods_discovery_state.list.list_state.selected = Some(0);
|
||||
ui.app.mods_discovery_state.begin_project_page();
|
||||
|
||||
ui.key(KeyCode::Char('v'));
|
||||
|
||||
assert!(ui.app.mods_discovery_state.version_popup.is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn instance_delete_can_be_cancelled_without_touching_disk() {
|
||||
let mut ui = UiHarness::new();
|
||||
@@ -171,9 +203,9 @@ fn instance_wizards_open_render_and_cancel_through_app_input() {
|
||||
assert_eq!(ui.app.focused, FocusedArea::ImportPopup);
|
||||
ui.draw();
|
||||
assert!(ui.screen().contains("Browse Modpacks"));
|
||||
ui.key(KeyCode::Char('d'));
|
||||
ui.key(KeyCode::Char('i'));
|
||||
ui.draw();
|
||||
assert!(ui.screen().contains("Direct Modpack Import"));
|
||||
assert!(ui.screen().contains("Import Modpack"));
|
||||
ui.key(KeyCode::Esc);
|
||||
assert_eq!(ui.app.focused, FocusedArea::ImportPopup);
|
||||
ui.key(KeyCode::Esc);
|
||||
|
||||
@@ -43,7 +43,19 @@ fn modpack_discovery_renders_active_search() {
|
||||
.draw(|frame| render_with_picker(frame, frame.area(), FocusedArea::ImportPopup, &picker))
|
||||
.unwrap();
|
||||
|
||||
assert!(format!("{}", terminal.backend()).contains("/ fabric\u{2588}"));
|
||||
let rendered = format!("{}", terminal.backend());
|
||||
assert!(rendered.contains("/ fabric\u{2588}"));
|
||||
assert!(rendered.contains("[v] versions"));
|
||||
assert!(rendered.contains("[i] import"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn modpack_project_page_only_shows_page_actions() {
|
||||
let hints = discovery_keybinds(true);
|
||||
|
||||
assert!(hints.contains(&("v", " versions")));
|
||||
assert!(!hints.iter().any(|(_, action)| *action == " search"));
|
||||
assert!(!hints.iter().any(|(_, action)| *action == " import"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
source: src/tui/tests/widgets/popups/import_modpack/render.rs
|
||||
expression: terminal.backend()
|
||||
---
|
||||
"╭Direct Modpack Import─────────────────────────────────────╮"
|
||||
"╭Import Modpack────────────────────────────────────────────╮"
|
||||
"│Name: Synthetic Pack │"
|
||||
"│Pack Version: 1.0.0 │"
|
||||
"│MC Version: 1.20.1 │"
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
source: src/tui/tests/widgets/popups/import_modpack/render.rs
|
||||
expression: terminal.backend()
|
||||
---
|
||||
"╭Direct Modpack Import─────────────────────────────────────╮"
|
||||
"╭Import Modpack────────────────────────────────────────────╮"
|
||||
"│Name: Vanilla Pack │"
|
||||
"│Pack Version: 2.0 │"
|
||||
"│MC Version: 1.20.1 │"
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
source: src/tui/tests/widgets/popups/import_modpack/render.rs
|
||||
expression: terminal.backend()
|
||||
---
|
||||
"╭Direct Modpack Import─────────────────────────────────────╮"
|
||||
"╭Import Modpack────────────────────────────────────────────╮"
|
||||
"│Fetching modpack info... │"
|
||||
"│ │"
|
||||
"│ │"
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
source: src/tui/tests/widgets/popups/import_modpack/render.rs
|
||||
expression: terminal.backend()
|
||||
---
|
||||
"╭Direct Modpack Import─────────────────────────────────────╮"
|
||||
"╭Import Modpack────────────────────────────────────────────╮"
|
||||
"│URL, slug, or pack file path...█ │"
|
||||
"│ │"
|
||||
"│ │"
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
source: src/tui/tests/widgets/popups/import_modpack/render.rs
|
||||
expression: terminal.backend()
|
||||
---
|
||||
"╭Direct Modpack Import─────────────────────────────────────╮"
|
||||
"╭Import Modpack────────────────────────────────────────────╮"
|
||||
"│▶ 1.0.0 1.20.1 fabric │"
|
||||
"│ 0.9.0 1.20.1 fabric │"
|
||||
"│ │"
|
||||
|
||||
Reference in new issue
Block a user