Add basic space switching
This commit is contained in:
@@ -49,6 +49,25 @@ fn new_tab_command_opens_new_tab() -> Result<(), Box<dyn Error>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn new_space_command_creates_and_selects_named_space() -> Result<(), Box<dyn Error>> {
|
||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||
|
||||
core.set_command_query(">new-space Research");
|
||||
let intent = core.submit_command()?;
|
||||
let snapshot = core.snapshot()?;
|
||||
let active_tab = core.active_tab()?;
|
||||
|
||||
assert_eq!(intent, Some(CommandIntent::Command("new-space Research".to_string())));
|
||||
assert_eq!(snapshot.spaces.len(), 2);
|
||||
assert_eq!(snapshot.active_space_name, "Research");
|
||||
assert_eq!(snapshot.tabs.len(), 1);
|
||||
assert_eq!(snapshot.tabs[0].space_id(), &snapshot.active_space_id);
|
||||
assert_eq!(active_tab.url().as_str(), "ely://new-tab");
|
||||
assert_eq!(snapshot.command_query, "");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn close_tab_command_closes_active_tab() -> Result<(), Box<dyn Error>> {
|
||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||
|
||||
Reference in New Issue
Block a user