refactor(core): split oversized integration-test files under 500-line audit
`scripts/audit_source_lines.sh` (a CI gate) flagged `tests/commands.rs` (527) and `tests/splits.rs` (524) over the 500-line ceiling. Both are flat lists of independent `#[test]` fns with no shared helpers, so each splits cleanly into a sibling integration-test binary (the crate already uses a topical file-per-concern layout under `tests/`). - commands.rs (29 tests) -> commands.rs (20: tab/space/profile/search) + command_pages.rs (9: internal-page-opening commands). 527 -> 389. - splits.rs (25 tests) -> splits.rs (13: layout/axis/detach mechanics) + saved_split_lifecycle.rs (12: close/archive/restore/group). 524 -> 266. No tests added or removed; each new file carries only the imports it uses. `cargo clippy -p ely_browser_core --tests -- -D warnings` clean; all ely_browser_core tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,142 @@
|
|||||||
|
use std::error::Error;
|
||||||
|
|
||||||
|
use ely_browser_core::{BrowserCore, InitialBrowserConfig};
|
||||||
|
use ely_domain::CommandIntent;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn open_downloads_command_opens_downloads_page() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
|
||||||
|
core.set_command_query(">open-downloads");
|
||||||
|
let intent = core.submit_command()?;
|
||||||
|
let snapshot = core.snapshot()?;
|
||||||
|
let active_tab = core.active_tab()?;
|
||||||
|
|
||||||
|
assert_eq!(intent, Some(CommandIntent::Command("open-downloads".to_string())));
|
||||||
|
assert_eq!(snapshot.tabs.len(), 2);
|
||||||
|
assert_eq!(active_tab.title(), "Downloads");
|
||||||
|
assert_eq!(active_tab.url().as_str(), "ely://downloads");
|
||||||
|
assert_eq!(snapshot.command_query, "");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn download_current_page_command_keeps_active_tab_for_shell_download() -> Result<(), Box<dyn Error>>
|
||||||
|
{
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
let active_tab_id = core.active_tab()?.id().clone();
|
||||||
|
|
||||||
|
core.set_command_query(">download-current-page");
|
||||||
|
let intent = core.submit_command()?;
|
||||||
|
let snapshot = core.snapshot()?;
|
||||||
|
|
||||||
|
assert_eq!(intent, Some(CommandIntent::Command("download-current-page".to_string())));
|
||||||
|
assert_eq!(snapshot.active_tab_id, active_tab_id);
|
||||||
|
assert_eq!(snapshot.command_query, "");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn open_history_command_opens_history_page() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
|
||||||
|
core.set_command_query(">open-history");
|
||||||
|
let intent = core.submit_command()?;
|
||||||
|
let active_tab = core.active_tab()?;
|
||||||
|
|
||||||
|
assert_eq!(intent, Some(CommandIntent::Command("open-history".to_string())));
|
||||||
|
assert_eq!(active_tab.title(), "History");
|
||||||
|
assert_eq!(active_tab.url().as_str(), "ely://history");
|
||||||
|
assert_eq!(core.snapshot()?.command_query, "");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn open_task_manager_command_opens_task_manager_page() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
|
||||||
|
core.set_command_query(">open-task-manager");
|
||||||
|
let intent = core.submit_command()?;
|
||||||
|
let active_tab = core.active_tab()?;
|
||||||
|
|
||||||
|
assert_eq!(intent, Some(CommandIntent::Command("open-task-manager".to_string())));
|
||||||
|
assert_eq!(active_tab.title(), "Task Manager");
|
||||||
|
assert_eq!(active_tab.url().as_str(), "ely://task-manager");
|
||||||
|
assert_eq!(core.snapshot()?.command_query, "");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn open_plugins_command_opens_plugin_marketplace_page() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
|
||||||
|
core.set_command_query(">plugins");
|
||||||
|
let intent = core.submit_command()?;
|
||||||
|
let active_tab = core.active_tab()?;
|
||||||
|
|
||||||
|
assert_eq!(intent, Some(CommandIntent::Command("plugins".to_string())));
|
||||||
|
assert_eq!(active_tab.title(), "Plugin Marketplace");
|
||||||
|
assert_eq!(active_tab.url().as_str(), "ely://plugins");
|
||||||
|
assert_eq!(core.snapshot()?.command_query, "");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn open_about_command_opens_about_page() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
|
||||||
|
core.set_command_query(">about");
|
||||||
|
let intent = core.submit_command()?;
|
||||||
|
let active_tab = core.active_tab()?;
|
||||||
|
|
||||||
|
assert_eq!(intent, Some(CommandIntent::Command("about".to_string())));
|
||||||
|
assert_eq!(active_tab.title(), "About ELY Browser");
|
||||||
|
assert_eq!(active_tab.url().as_str(), "ely://about");
|
||||||
|
assert_eq!(core.snapshot()?.command_query, "");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn open_settings_command_opens_settings_page() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
|
||||||
|
core.set_command_query(">open-settings");
|
||||||
|
let intent = core.submit_command()?;
|
||||||
|
let active_tab = core.active_tab()?;
|
||||||
|
|
||||||
|
assert_eq!(intent, Some(CommandIntent::Command("open-settings".to_string())));
|
||||||
|
assert_eq!(active_tab.title(), "Settings");
|
||||||
|
assert_eq!(active_tab.url().as_str(), "ely://settings");
|
||||||
|
assert_eq!(core.snapshot()?.command_query, "");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn open_shortcuts_command_opens_shortcuts_page() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
|
||||||
|
core.set_command_query(">open-shortcuts");
|
||||||
|
let intent = core.submit_command()?;
|
||||||
|
let active_tab = core.active_tab()?;
|
||||||
|
|
||||||
|
assert_eq!(intent, Some(CommandIntent::Command("open-shortcuts".to_string())));
|
||||||
|
assert_eq!(active_tab.title(), "Shortcut Settings");
|
||||||
|
assert_eq!(active_tab.url().as_str(), "ely://settings/shortcuts");
|
||||||
|
assert_eq!(core.snapshot()?.command_query, "");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn open_sync_status_command_opens_sync_status_page() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
|
||||||
|
core.set_command_query(">open-sync-status");
|
||||||
|
let intent = core.submit_command()?;
|
||||||
|
let active_tab = core.active_tab()?;
|
||||||
|
|
||||||
|
assert_eq!(intent, Some(CommandIntent::Command("open-sync-status".to_string())));
|
||||||
|
assert_eq!(active_tab.title(), "Sync Status");
|
||||||
|
assert_eq!(active_tab.url().as_str(), "ely://sync/status");
|
||||||
|
assert_eq!(core.snapshot()?.command_query, "");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
@@ -49,144 +49,6 @@ fn new_tab_command_opens_new_tab() -> Result<(), Box<dyn Error>> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn open_downloads_command_opens_downloads_page() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
|
|
||||||
core.set_command_query(">open-downloads");
|
|
||||||
let intent = core.submit_command()?;
|
|
||||||
let snapshot = core.snapshot()?;
|
|
||||||
let active_tab = core.active_tab()?;
|
|
||||||
|
|
||||||
assert_eq!(intent, Some(CommandIntent::Command("open-downloads".to_string())));
|
|
||||||
assert_eq!(snapshot.tabs.len(), 2);
|
|
||||||
assert_eq!(active_tab.title(), "Downloads");
|
|
||||||
assert_eq!(active_tab.url().as_str(), "ely://downloads");
|
|
||||||
assert_eq!(snapshot.command_query, "");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn download_current_page_command_keeps_active_tab_for_shell_download() -> Result<(), Box<dyn Error>>
|
|
||||||
{
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
let active_tab_id = core.active_tab()?.id().clone();
|
|
||||||
|
|
||||||
core.set_command_query(">download-current-page");
|
|
||||||
let intent = core.submit_command()?;
|
|
||||||
let snapshot = core.snapshot()?;
|
|
||||||
|
|
||||||
assert_eq!(intent, Some(CommandIntent::Command("download-current-page".to_string())));
|
|
||||||
assert_eq!(snapshot.active_tab_id, active_tab_id);
|
|
||||||
assert_eq!(snapshot.command_query, "");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn open_history_command_opens_history_page() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
|
|
||||||
core.set_command_query(">open-history");
|
|
||||||
let intent = core.submit_command()?;
|
|
||||||
let active_tab = core.active_tab()?;
|
|
||||||
|
|
||||||
assert_eq!(intent, Some(CommandIntent::Command("open-history".to_string())));
|
|
||||||
assert_eq!(active_tab.title(), "History");
|
|
||||||
assert_eq!(active_tab.url().as_str(), "ely://history");
|
|
||||||
assert_eq!(core.snapshot()?.command_query, "");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn open_task_manager_command_opens_task_manager_page() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
|
|
||||||
core.set_command_query(">open-task-manager");
|
|
||||||
let intent = core.submit_command()?;
|
|
||||||
let active_tab = core.active_tab()?;
|
|
||||||
|
|
||||||
assert_eq!(intent, Some(CommandIntent::Command("open-task-manager".to_string())));
|
|
||||||
assert_eq!(active_tab.title(), "Task Manager");
|
|
||||||
assert_eq!(active_tab.url().as_str(), "ely://task-manager");
|
|
||||||
assert_eq!(core.snapshot()?.command_query, "");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn open_plugins_command_opens_plugin_marketplace_page() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
|
|
||||||
core.set_command_query(">plugins");
|
|
||||||
let intent = core.submit_command()?;
|
|
||||||
let active_tab = core.active_tab()?;
|
|
||||||
|
|
||||||
assert_eq!(intent, Some(CommandIntent::Command("plugins".to_string())));
|
|
||||||
assert_eq!(active_tab.title(), "Plugin Marketplace");
|
|
||||||
assert_eq!(active_tab.url().as_str(), "ely://plugins");
|
|
||||||
assert_eq!(core.snapshot()?.command_query, "");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn open_about_command_opens_about_page() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
|
|
||||||
core.set_command_query(">about");
|
|
||||||
let intent = core.submit_command()?;
|
|
||||||
let active_tab = core.active_tab()?;
|
|
||||||
|
|
||||||
assert_eq!(intent, Some(CommandIntent::Command("about".to_string())));
|
|
||||||
assert_eq!(active_tab.title(), "About ELY Browser");
|
|
||||||
assert_eq!(active_tab.url().as_str(), "ely://about");
|
|
||||||
assert_eq!(core.snapshot()?.command_query, "");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn open_settings_command_opens_settings_page() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
|
|
||||||
core.set_command_query(">open-settings");
|
|
||||||
let intent = core.submit_command()?;
|
|
||||||
let active_tab = core.active_tab()?;
|
|
||||||
|
|
||||||
assert_eq!(intent, Some(CommandIntent::Command("open-settings".to_string())));
|
|
||||||
assert_eq!(active_tab.title(), "Settings");
|
|
||||||
assert_eq!(active_tab.url().as_str(), "ely://settings");
|
|
||||||
assert_eq!(core.snapshot()?.command_query, "");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn open_shortcuts_command_opens_shortcuts_page() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
|
|
||||||
core.set_command_query(">open-shortcuts");
|
|
||||||
let intent = core.submit_command()?;
|
|
||||||
let active_tab = core.active_tab()?;
|
|
||||||
|
|
||||||
assert_eq!(intent, Some(CommandIntent::Command("open-shortcuts".to_string())));
|
|
||||||
assert_eq!(active_tab.title(), "Shortcut Settings");
|
|
||||||
assert_eq!(active_tab.url().as_str(), "ely://settings/shortcuts");
|
|
||||||
assert_eq!(core.snapshot()?.command_query, "");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn open_sync_status_command_opens_sync_status_page() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
|
|
||||||
core.set_command_query(">open-sync-status");
|
|
||||||
let intent = core.submit_command()?;
|
|
||||||
let active_tab = core.active_tab()?;
|
|
||||||
|
|
||||||
assert_eq!(intent, Some(CommandIntent::Command("open-sync-status".to_string())));
|
|
||||||
assert_eq!(active_tab.title(), "Sync Status");
|
|
||||||
assert_eq!(active_tab.url().as_str(), "ely://sync/status");
|
|
||||||
assert_eq!(core.snapshot()?.command_query, "");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn plain_text_command_searches_with_selected_engine() -> Result<(), Box<dyn Error>> {
|
fn plain_text_command_searches_with_selected_engine() -> Result<(), Box<dyn Error>> {
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
|||||||
@@ -0,0 +1,263 @@
|
|||||||
|
use std::error::Error;
|
||||||
|
|
||||||
|
use ely_browser_core::{BrowserCore, InitialBrowserConfig};
|
||||||
|
use ely_domain::{CommandIntent, UrlText};
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn close_active_tab_archives_saved_split_view() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
let remaining_tab_id = core.active_tab()?.id().clone();
|
||||||
|
core.open_tab(UrlText::parse("https://example.com/saved-split")?);
|
||||||
|
core.split_active_tab_right()?;
|
||||||
|
core.save_active_split_view()?;
|
||||||
|
|
||||||
|
let active_tab_id = core.close_active_tab()?;
|
||||||
|
let snapshot = core.snapshot()?;
|
||||||
|
|
||||||
|
assert_eq!(active_tab_id, remaining_tab_id);
|
||||||
|
assert_eq!(snapshot.active_tab_id, remaining_tab_id);
|
||||||
|
assert!(snapshot.split_layouts.is_empty());
|
||||||
|
assert_eq!(snapshot.tabs.len(), 1);
|
||||||
|
assert_eq!(snapshot.archived_tabs.len(), 2);
|
||||||
|
let archived_split_id =
|
||||||
|
snapshot.archived_tabs[0].tab().split_id().ok_or("missing archived split id")?;
|
||||||
|
assert!(
|
||||||
|
snapshot
|
||||||
|
.archived_tabs
|
||||||
|
.iter()
|
||||||
|
.all(|archived| archived.tab().split_id() == Some(archived_split_id))
|
||||||
|
);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn close_saved_split_member_archives_entire_saved_split_view() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
let remaining_tab_id = core.active_tab()?.id().clone();
|
||||||
|
core.open_tab(UrlText::parse("https://example.com/saved-split")?);
|
||||||
|
core.split_active_tab_right()?;
|
||||||
|
core.save_active_split_view()?;
|
||||||
|
let left_pane_id = core.snapshot()?.split_layouts[0].panes()[0].tab_id().clone();
|
||||||
|
|
||||||
|
let active_tab_id = core.close_tab(&left_pane_id)?;
|
||||||
|
let snapshot = core.snapshot()?;
|
||||||
|
|
||||||
|
assert_eq!(active_tab_id, remaining_tab_id);
|
||||||
|
assert!(snapshot.split_layouts.is_empty());
|
||||||
|
assert_eq!(snapshot.tabs.len(), 1);
|
||||||
|
assert_eq!(snapshot.archived_tabs.len(), 2);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn close_split_view_command_archives_active_saved_split_view() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
let remaining_tab_id = core.active_tab()?.id().clone();
|
||||||
|
core.open_tab(UrlText::parse("https://example.com/saved-split")?);
|
||||||
|
core.split_active_tab_right()?;
|
||||||
|
core.save_active_split_view()?;
|
||||||
|
|
||||||
|
core.set_command_query(">close-split-view");
|
||||||
|
let intent = core.submit_command()?;
|
||||||
|
let snapshot = core.snapshot()?;
|
||||||
|
|
||||||
|
assert_eq!(intent, Some(CommandIntent::Command("close-split-view".to_string())));
|
||||||
|
assert_eq!(snapshot.active_tab_id, remaining_tab_id);
|
||||||
|
assert!(snapshot.split_layouts.is_empty());
|
||||||
|
assert_eq!(snapshot.archived_tabs.len(), 2);
|
||||||
|
assert_eq!(snapshot.command_query, "");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn close_split_view_command_preserves_query_without_saved_split() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
core.split_active_tab_right()?;
|
||||||
|
let active_tab_id = core.active_tab()?.id().clone();
|
||||||
|
|
||||||
|
core.set_command_query(">close-split-view");
|
||||||
|
let intent = core.submit_command()?;
|
||||||
|
let snapshot = core.snapshot()?;
|
||||||
|
|
||||||
|
assert_eq!(intent, Some(CommandIntent::Command("close-split-view".to_string())));
|
||||||
|
assert_eq!(snapshot.active_tab_id, active_tab_id);
|
||||||
|
assert_eq!(snapshot.split_layouts.len(), 1);
|
||||||
|
assert_eq!(snapshot.command_query, ">close-split-view");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn split_view_to_group_command_converts_active_split() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
let first_tab_id = core.active_tab()?.id().clone();
|
||||||
|
core.split_active_tab_right()?;
|
||||||
|
let second_tab_id = core.active_tab()?.id().clone();
|
||||||
|
core.save_active_split_view()?;
|
||||||
|
|
||||||
|
core.set_command_query(">split-view-to-group Research");
|
||||||
|
let intent = core.submit_command()?;
|
||||||
|
let snapshot = core.snapshot()?;
|
||||||
|
let group = snapshot.tab_groups.first().ok_or("missing tab group")?;
|
||||||
|
let grouped_tab_ids = snapshot
|
||||||
|
.tabs
|
||||||
|
.iter()
|
||||||
|
.filter(|tab| tab.group_id() == Some(group.id()))
|
||||||
|
.map(|tab| tab.id().clone())
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
assert_eq!(intent, Some(CommandIntent::Command("split-view-to-group Research".to_string())));
|
||||||
|
assert_eq!(snapshot.active_tab_id, second_tab_id);
|
||||||
|
assert!(snapshot.split_layouts.is_empty());
|
||||||
|
assert_eq!(snapshot.tab_groups.len(), 1);
|
||||||
|
assert_eq!(group.name(), "Research");
|
||||||
|
assert_eq!(grouped_tab_ids, vec![first_tab_id, second_tab_id]);
|
||||||
|
assert!(snapshot.tabs.iter().all(|tab| tab.split_id().is_none()));
|
||||||
|
assert_eq!(snapshot.command_query, "");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn split_view_to_group_command_uses_saved_split_title_without_name() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
core.split_active_tab_right()?;
|
||||||
|
core.save_active_split_view()?;
|
||||||
|
|
||||||
|
core.set_command_query(">split-view-to-group");
|
||||||
|
let intent = core.submit_command()?;
|
||||||
|
let snapshot = core.snapshot()?;
|
||||||
|
let group = snapshot.tab_groups.first().ok_or("missing tab group")?;
|
||||||
|
|
||||||
|
assert_eq!(intent, Some(CommandIntent::Command("split-view-to-group".to_string())));
|
||||||
|
assert!(snapshot.split_layouts.is_empty());
|
||||||
|
assert_eq!(group.name(), "Split View: New Tab + New Tab");
|
||||||
|
assert_eq!(snapshot.command_query, "");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn split_view_to_group_command_preserves_query_without_active_split() -> Result<(), Box<dyn Error>>
|
||||||
|
{
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
let active_tab_id = core.active_tab()?.id().clone();
|
||||||
|
|
||||||
|
core.set_command_query(">split-view-to-group Research");
|
||||||
|
let intent = core.submit_command()?;
|
||||||
|
let snapshot = core.snapshot()?;
|
||||||
|
|
||||||
|
assert_eq!(intent, Some(CommandIntent::Command("split-view-to-group Research".to_string())));
|
||||||
|
assert_eq!(snapshot.active_tab_id, active_tab_id);
|
||||||
|
assert!(snapshot.tab_groups.is_empty());
|
||||||
|
assert!(snapshot.split_layouts.is_empty());
|
||||||
|
assert_eq!(snapshot.command_query, ">split-view-to-group Research");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn restore_last_archived_tab_restores_saved_split_view() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
let remaining_tab_id = core.active_tab()?.id().clone();
|
||||||
|
core.open_tab(UrlText::parse("https://example.com/saved-split")?);
|
||||||
|
let split_id = core.split_active_tab_right()?;
|
||||||
|
let focused_pane_id = core.active_tab()?.id().clone();
|
||||||
|
core.save_active_split_view()?;
|
||||||
|
core.close_active_tab()?;
|
||||||
|
|
||||||
|
let restored_tab_id = core.restore_last_archived_tab()?;
|
||||||
|
let snapshot = core.snapshot()?;
|
||||||
|
|
||||||
|
assert_eq!(restored_tab_id, focused_pane_id);
|
||||||
|
assert_eq!(snapshot.active_tab_id, focused_pane_id);
|
||||||
|
assert_eq!(snapshot.tabs.len(), 3);
|
||||||
|
assert!(snapshot.archived_tabs.is_empty());
|
||||||
|
let restored_layout = snapshot
|
||||||
|
.split_layouts
|
||||||
|
.iter()
|
||||||
|
.find(|layout| layout.id() == &split_id)
|
||||||
|
.ok_or("missing restored split layout")?;
|
||||||
|
assert!(restored_layout.saved());
|
||||||
|
assert_eq!(restored_layout.pane_count(), 2);
|
||||||
|
assert!(snapshot.tabs.iter().any(|tab| tab.id() == &remaining_tab_id));
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn restore_archived_split_member_restores_entire_saved_split_view() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
core.open_tab(UrlText::parse("https://example.com/saved-split")?);
|
||||||
|
let split_id = core.split_active_tab_right()?;
|
||||||
|
core.save_active_split_view()?;
|
||||||
|
let left_pane_id = core.snapshot()?.split_layouts[0].panes()[0].tab_id().clone();
|
||||||
|
core.close_active_tab()?;
|
||||||
|
|
||||||
|
let restored_tab_id = core.restore_archived_tab(&left_pane_id)?;
|
||||||
|
let snapshot = core.snapshot()?;
|
||||||
|
|
||||||
|
assert_eq!(restored_tab_id, left_pane_id);
|
||||||
|
assert_eq!(snapshot.active_tab_id, left_pane_id);
|
||||||
|
assert!(snapshot.archived_tabs.is_empty());
|
||||||
|
assert_eq!(snapshot.split_layouts.len(), 1);
|
||||||
|
assert_eq!(snapshot.split_layouts[0].id(), &split_id);
|
||||||
|
assert_eq!(snapshot.split_layouts[0].pane_count(), 2);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn archived_split_search_restores_entire_saved_split_view() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
core.open_tab(UrlText::parse("https://example.com/saved-split")?);
|
||||||
|
let split_id = core.split_active_tab_right()?;
|
||||||
|
core.save_active_split_view()?;
|
||||||
|
let left_pane_id = core.snapshot()?.split_layouts[0].panes()[0].tab_id().clone();
|
||||||
|
core.close_active_tab()?;
|
||||||
|
|
||||||
|
let restored_tab_id = core.restore_archived_tab_match("saved-split")?;
|
||||||
|
let snapshot = core.snapshot()?;
|
||||||
|
|
||||||
|
assert_eq!(restored_tab_id, Some(left_pane_id));
|
||||||
|
assert!(snapshot.archived_tabs.is_empty());
|
||||||
|
assert_eq!(snapshot.split_layouts.len(), 1);
|
||||||
|
assert_eq!(snapshot.split_layouts[0].id(), &split_id);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn closing_split_pane_dissolves_two_pane_layout() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
let remaining_tab_id = core.active_tab()?.id().clone();
|
||||||
|
core.split_active_tab_right()?;
|
||||||
|
|
||||||
|
core.close_active_tab()?;
|
||||||
|
let snapshot = core.snapshot()?;
|
||||||
|
|
||||||
|
assert!(snapshot.split_layouts.is_empty());
|
||||||
|
assert_eq!(snapshot.tabs.len(), 1);
|
||||||
|
assert_eq!(snapshot.active_tab_id, remaining_tab_id);
|
||||||
|
assert_eq!(snapshot.tabs[0].split_id(), None);
|
||||||
|
assert_eq!(snapshot.archived_tabs.len(), 1);
|
||||||
|
assert_eq!(snapshot.archived_tabs[0].tab().split_id(), None);
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn moving_split_pane_dissolves_source_layout() -> Result<(), Box<dyn Error>> {
|
||||||
|
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||||
|
let work_space_id = core.snapshot()?.active_space_id;
|
||||||
|
let moved_tab_id = {
|
||||||
|
let research_space_id = core.create_space("Research", "R", 0xf54e00)?;
|
||||||
|
core.select_space(&work_space_id)?;
|
||||||
|
core.split_active_tab_right()?;
|
||||||
|
let moved_tab_id = core.active_tab()?.id().clone();
|
||||||
|
core.move_active_tab_to_space(&research_space_id)?;
|
||||||
|
moved_tab_id
|
||||||
|
};
|
||||||
|
|
||||||
|
let research_snapshot = core.snapshot()?;
|
||||||
|
assert_eq!(research_snapshot.active_tab_id, moved_tab_id);
|
||||||
|
assert!(research_snapshot.split_layouts.is_empty());
|
||||||
|
|
||||||
|
core.select_space(&work_space_id)?;
|
||||||
|
let work_snapshot = core.snapshot()?;
|
||||||
|
assert!(work_snapshot.split_layouts.is_empty());
|
||||||
|
assert!(work_snapshot.tabs.iter().all(|tab| tab.split_id().is_none()));
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
@@ -264,261 +264,3 @@ fn detach_split_pane_refreshes_saved_split_title() -> Result<(), Box<dyn Error>>
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn close_active_tab_archives_saved_split_view() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
let remaining_tab_id = core.active_tab()?.id().clone();
|
|
||||||
core.open_tab(UrlText::parse("https://example.com/saved-split")?);
|
|
||||||
core.split_active_tab_right()?;
|
|
||||||
core.save_active_split_view()?;
|
|
||||||
|
|
||||||
let active_tab_id = core.close_active_tab()?;
|
|
||||||
let snapshot = core.snapshot()?;
|
|
||||||
|
|
||||||
assert_eq!(active_tab_id, remaining_tab_id);
|
|
||||||
assert_eq!(snapshot.active_tab_id, remaining_tab_id);
|
|
||||||
assert!(snapshot.split_layouts.is_empty());
|
|
||||||
assert_eq!(snapshot.tabs.len(), 1);
|
|
||||||
assert_eq!(snapshot.archived_tabs.len(), 2);
|
|
||||||
let archived_split_id =
|
|
||||||
snapshot.archived_tabs[0].tab().split_id().ok_or("missing archived split id")?;
|
|
||||||
assert!(
|
|
||||||
snapshot
|
|
||||||
.archived_tabs
|
|
||||||
.iter()
|
|
||||||
.all(|archived| archived.tab().split_id() == Some(archived_split_id))
|
|
||||||
);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn close_saved_split_member_archives_entire_saved_split_view() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
let remaining_tab_id = core.active_tab()?.id().clone();
|
|
||||||
core.open_tab(UrlText::parse("https://example.com/saved-split")?);
|
|
||||||
core.split_active_tab_right()?;
|
|
||||||
core.save_active_split_view()?;
|
|
||||||
let left_pane_id = core.snapshot()?.split_layouts[0].panes()[0].tab_id().clone();
|
|
||||||
|
|
||||||
let active_tab_id = core.close_tab(&left_pane_id)?;
|
|
||||||
let snapshot = core.snapshot()?;
|
|
||||||
|
|
||||||
assert_eq!(active_tab_id, remaining_tab_id);
|
|
||||||
assert!(snapshot.split_layouts.is_empty());
|
|
||||||
assert_eq!(snapshot.tabs.len(), 1);
|
|
||||||
assert_eq!(snapshot.archived_tabs.len(), 2);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn close_split_view_command_archives_active_saved_split_view() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
let remaining_tab_id = core.active_tab()?.id().clone();
|
|
||||||
core.open_tab(UrlText::parse("https://example.com/saved-split")?);
|
|
||||||
core.split_active_tab_right()?;
|
|
||||||
core.save_active_split_view()?;
|
|
||||||
|
|
||||||
core.set_command_query(">close-split-view");
|
|
||||||
let intent = core.submit_command()?;
|
|
||||||
let snapshot = core.snapshot()?;
|
|
||||||
|
|
||||||
assert_eq!(intent, Some(CommandIntent::Command("close-split-view".to_string())));
|
|
||||||
assert_eq!(snapshot.active_tab_id, remaining_tab_id);
|
|
||||||
assert!(snapshot.split_layouts.is_empty());
|
|
||||||
assert_eq!(snapshot.archived_tabs.len(), 2);
|
|
||||||
assert_eq!(snapshot.command_query, "");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn close_split_view_command_preserves_query_without_saved_split() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
core.split_active_tab_right()?;
|
|
||||||
let active_tab_id = core.active_tab()?.id().clone();
|
|
||||||
|
|
||||||
core.set_command_query(">close-split-view");
|
|
||||||
let intent = core.submit_command()?;
|
|
||||||
let snapshot = core.snapshot()?;
|
|
||||||
|
|
||||||
assert_eq!(intent, Some(CommandIntent::Command("close-split-view".to_string())));
|
|
||||||
assert_eq!(snapshot.active_tab_id, active_tab_id);
|
|
||||||
assert_eq!(snapshot.split_layouts.len(), 1);
|
|
||||||
assert_eq!(snapshot.command_query, ">close-split-view");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn split_view_to_group_command_converts_active_split() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
let first_tab_id = core.active_tab()?.id().clone();
|
|
||||||
core.split_active_tab_right()?;
|
|
||||||
let second_tab_id = core.active_tab()?.id().clone();
|
|
||||||
core.save_active_split_view()?;
|
|
||||||
|
|
||||||
core.set_command_query(">split-view-to-group Research");
|
|
||||||
let intent = core.submit_command()?;
|
|
||||||
let snapshot = core.snapshot()?;
|
|
||||||
let group = snapshot.tab_groups.first().ok_or("missing tab group")?;
|
|
||||||
let grouped_tab_ids = snapshot
|
|
||||||
.tabs
|
|
||||||
.iter()
|
|
||||||
.filter(|tab| tab.group_id() == Some(group.id()))
|
|
||||||
.map(|tab| tab.id().clone())
|
|
||||||
.collect::<Vec<_>>();
|
|
||||||
|
|
||||||
assert_eq!(intent, Some(CommandIntent::Command("split-view-to-group Research".to_string())));
|
|
||||||
assert_eq!(snapshot.active_tab_id, second_tab_id);
|
|
||||||
assert!(snapshot.split_layouts.is_empty());
|
|
||||||
assert_eq!(snapshot.tab_groups.len(), 1);
|
|
||||||
assert_eq!(group.name(), "Research");
|
|
||||||
assert_eq!(grouped_tab_ids, vec![first_tab_id, second_tab_id]);
|
|
||||||
assert!(snapshot.tabs.iter().all(|tab| tab.split_id().is_none()));
|
|
||||||
assert_eq!(snapshot.command_query, "");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn split_view_to_group_command_uses_saved_split_title_without_name() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
core.split_active_tab_right()?;
|
|
||||||
core.save_active_split_view()?;
|
|
||||||
|
|
||||||
core.set_command_query(">split-view-to-group");
|
|
||||||
let intent = core.submit_command()?;
|
|
||||||
let snapshot = core.snapshot()?;
|
|
||||||
let group = snapshot.tab_groups.first().ok_or("missing tab group")?;
|
|
||||||
|
|
||||||
assert_eq!(intent, Some(CommandIntent::Command("split-view-to-group".to_string())));
|
|
||||||
assert!(snapshot.split_layouts.is_empty());
|
|
||||||
assert_eq!(group.name(), "Split View: New Tab + New Tab");
|
|
||||||
assert_eq!(snapshot.command_query, "");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn split_view_to_group_command_preserves_query_without_active_split() -> Result<(), Box<dyn Error>>
|
|
||||||
{
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
let active_tab_id = core.active_tab()?.id().clone();
|
|
||||||
|
|
||||||
core.set_command_query(">split-view-to-group Research");
|
|
||||||
let intent = core.submit_command()?;
|
|
||||||
let snapshot = core.snapshot()?;
|
|
||||||
|
|
||||||
assert_eq!(intent, Some(CommandIntent::Command("split-view-to-group Research".to_string())));
|
|
||||||
assert_eq!(snapshot.active_tab_id, active_tab_id);
|
|
||||||
assert!(snapshot.tab_groups.is_empty());
|
|
||||||
assert!(snapshot.split_layouts.is_empty());
|
|
||||||
assert_eq!(snapshot.command_query, ">split-view-to-group Research");
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn restore_last_archived_tab_restores_saved_split_view() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
let remaining_tab_id = core.active_tab()?.id().clone();
|
|
||||||
core.open_tab(UrlText::parse("https://example.com/saved-split")?);
|
|
||||||
let split_id = core.split_active_tab_right()?;
|
|
||||||
let focused_pane_id = core.active_tab()?.id().clone();
|
|
||||||
core.save_active_split_view()?;
|
|
||||||
core.close_active_tab()?;
|
|
||||||
|
|
||||||
let restored_tab_id = core.restore_last_archived_tab()?;
|
|
||||||
let snapshot = core.snapshot()?;
|
|
||||||
|
|
||||||
assert_eq!(restored_tab_id, focused_pane_id);
|
|
||||||
assert_eq!(snapshot.active_tab_id, focused_pane_id);
|
|
||||||
assert_eq!(snapshot.tabs.len(), 3);
|
|
||||||
assert!(snapshot.archived_tabs.is_empty());
|
|
||||||
let restored_layout = snapshot
|
|
||||||
.split_layouts
|
|
||||||
.iter()
|
|
||||||
.find(|layout| layout.id() == &split_id)
|
|
||||||
.ok_or("missing restored split layout")?;
|
|
||||||
assert!(restored_layout.saved());
|
|
||||||
assert_eq!(restored_layout.pane_count(), 2);
|
|
||||||
assert!(snapshot.tabs.iter().any(|tab| tab.id() == &remaining_tab_id));
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn restore_archived_split_member_restores_entire_saved_split_view() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
core.open_tab(UrlText::parse("https://example.com/saved-split")?);
|
|
||||||
let split_id = core.split_active_tab_right()?;
|
|
||||||
core.save_active_split_view()?;
|
|
||||||
let left_pane_id = core.snapshot()?.split_layouts[0].panes()[0].tab_id().clone();
|
|
||||||
core.close_active_tab()?;
|
|
||||||
|
|
||||||
let restored_tab_id = core.restore_archived_tab(&left_pane_id)?;
|
|
||||||
let snapshot = core.snapshot()?;
|
|
||||||
|
|
||||||
assert_eq!(restored_tab_id, left_pane_id);
|
|
||||||
assert_eq!(snapshot.active_tab_id, left_pane_id);
|
|
||||||
assert!(snapshot.archived_tabs.is_empty());
|
|
||||||
assert_eq!(snapshot.split_layouts.len(), 1);
|
|
||||||
assert_eq!(snapshot.split_layouts[0].id(), &split_id);
|
|
||||||
assert_eq!(snapshot.split_layouts[0].pane_count(), 2);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn archived_split_search_restores_entire_saved_split_view() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
core.open_tab(UrlText::parse("https://example.com/saved-split")?);
|
|
||||||
let split_id = core.split_active_tab_right()?;
|
|
||||||
core.save_active_split_view()?;
|
|
||||||
let left_pane_id = core.snapshot()?.split_layouts[0].panes()[0].tab_id().clone();
|
|
||||||
core.close_active_tab()?;
|
|
||||||
|
|
||||||
let restored_tab_id = core.restore_archived_tab_match("saved-split")?;
|
|
||||||
let snapshot = core.snapshot()?;
|
|
||||||
|
|
||||||
assert_eq!(restored_tab_id, Some(left_pane_id));
|
|
||||||
assert!(snapshot.archived_tabs.is_empty());
|
|
||||||
assert_eq!(snapshot.split_layouts.len(), 1);
|
|
||||||
assert_eq!(snapshot.split_layouts[0].id(), &split_id);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn closing_split_pane_dissolves_two_pane_layout() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
let remaining_tab_id = core.active_tab()?.id().clone();
|
|
||||||
core.split_active_tab_right()?;
|
|
||||||
|
|
||||||
core.close_active_tab()?;
|
|
||||||
let snapshot = core.snapshot()?;
|
|
||||||
|
|
||||||
assert!(snapshot.split_layouts.is_empty());
|
|
||||||
assert_eq!(snapshot.tabs.len(), 1);
|
|
||||||
assert_eq!(snapshot.active_tab_id, remaining_tab_id);
|
|
||||||
assert_eq!(snapshot.tabs[0].split_id(), None);
|
|
||||||
assert_eq!(snapshot.archived_tabs.len(), 1);
|
|
||||||
assert_eq!(snapshot.archived_tabs[0].tab().split_id(), None);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn moving_split_pane_dissolves_source_layout() -> Result<(), Box<dyn Error>> {
|
|
||||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
|
||||||
let work_space_id = core.snapshot()?.active_space_id;
|
|
||||||
let moved_tab_id = {
|
|
||||||
let research_space_id = core.create_space("Research", "R", 0xf54e00)?;
|
|
||||||
core.select_space(&work_space_id)?;
|
|
||||||
core.split_active_tab_right()?;
|
|
||||||
let moved_tab_id = core.active_tab()?.id().clone();
|
|
||||||
core.move_active_tab_to_space(&research_space_id)?;
|
|
||||||
moved_tab_id
|
|
||||||
};
|
|
||||||
|
|
||||||
let research_snapshot = core.snapshot()?;
|
|
||||||
assert_eq!(research_snapshot.active_tab_id, moved_tab_id);
|
|
||||||
assert!(research_snapshot.split_layouts.is_empty());
|
|
||||||
|
|
||||||
core.select_space(&work_space_id)?;
|
|
||||||
let work_snapshot = core.snapshot()?;
|
|
||||||
assert!(work_snapshot.split_layouts.is_empty());
|
|
||||||
assert!(work_snapshot.tabs.iter().all(|tab| tab.split_id().is_none()));
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user