fix(discovery): layer version popup above details
This commit is contained in:
1 parent
257cec9f41
commit
2aa45fe15a
2 files changed
+46
-11
No files matched your search
@@ -53,6 +53,41 @@ fn discovery_version_popup_uses_compact_heights() {
|
|||||||
assert_eq!(version_popup_height(0, false, false, true), 8);
|
assert_eq!(version_popup_height(0, false, false, true), 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn discovery_version_popup_renders_over_a_project_page() {
|
||||||
|
use crate::instance::ContentKind;
|
||||||
|
use crate::net::modrinth::DiscoveryProject;
|
||||||
|
use ratatui::{Terminal, backend::TestBackend};
|
||||||
|
|
||||||
|
let project = DiscoveryProject {
|
||||||
|
id: "project".to_owned(),
|
||||||
|
slug: "project".to_owned(),
|
||||||
|
title: "Project".to_owned(),
|
||||||
|
description: String::new(),
|
||||||
|
downloads: 0,
|
||||||
|
icon_url: None,
|
||||||
|
icon_bytes: None,
|
||||||
|
};
|
||||||
|
let mut state = DiscoveryState::new(ContentKind::Mod);
|
||||||
|
state
|
||||||
|
.list
|
||||||
|
.entries
|
||||||
|
.push(crate::tui::widgets::content::discovery::project_entry(
|
||||||
|
project, None,
|
||||||
|
));
|
||||||
|
state.list.list_state.selected = Some(0);
|
||||||
|
state.begin_project_page();
|
||||||
|
state.begin_versions();
|
||||||
|
|
||||||
|
let mut terminal = Terminal::new(TestBackend::new(80, 20)).unwrap();
|
||||||
|
let picker = ratatui_image::picker::Picker::halfblocks();
|
||||||
|
terminal
|
||||||
|
.draw(|frame| render_discovery_popup(frame, frame.area(), &mut state, &picker))
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
assert!(format!("{}", terminal.backend()).contains("Install Project"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn confirmation_metadata_is_human_readable() {
|
fn confirmation_metadata_is_human_readable() {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|||||||
@@ -593,18 +593,18 @@ fn render_discovery_body(
|
|||||||
area,
|
area,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return;
|
} else {
|
||||||
|
let empty_text = state.empty_text().to_string();
|
||||||
|
super::list::render(
|
||||||
|
frame,
|
||||||
|
area,
|
||||||
|
&mut state.list,
|
||||||
|
is_focused,
|
||||||
|
loading_text,
|
||||||
|
&empty_text,
|
||||||
|
picker,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
let empty_text = state.empty_text().to_string();
|
|
||||||
super::list::render(
|
|
||||||
frame,
|
|
||||||
area,
|
|
||||||
&mut state.list,
|
|
||||||
is_focused,
|
|
||||||
loading_text,
|
|
||||||
&empty_text,
|
|
||||||
picker,
|
|
||||||
);
|
|
||||||
if state.version_popup.is_some() {
|
if state.version_popup.is_some() {
|
||||||
render_version_popup(frame, area, state);
|
render_version_popup(frame, area, state);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user