Lines
100 %
Functions
Branches
//! A palette request from a window that is not a console goes to the front console, or a new one.
use crate::app::App;
use crate::tabs::nms::ConsoleState;
use crate::view::ViewId;
use crate::window::WindowId;
fn run_palette(app: &mut App, line: &str) {
super::super::palette_run::submit_palette(app, line);
}
fn scrollback_of(app: &App, console: WindowId) -> Vec<String> {
app.win::<ConsoleState>(console)
.map(|state| state.scrollback.clone())
.unwrap_or_default()
#[tokio::test]
async fn a_request_from_a_list_window_lands_in_the_front_console() {
let mut app = crate::test_support::app();
app.attach_echo();
let console = app.window_of(ViewId::Console);
assert!(app.front_is(ViewId::Accounts));
run_palette(&mut app, "version");
assert_eq!(scrollback_of(&app, console), ["> (get-version)"]);
assert!(app.front_is(ViewId::Console));
async fn a_request_with_no_console_opens_one() {
app.close_window(app.window_of(ViewId::Console));
assert!(app.window_id(ViewId::Console).is_none());