Open settings pages from scoped search

This commit is contained in:
2026-05-07 21:03:29 -04:00
parent 3fe737adad
commit 3bcf4460ca
3 changed files with 75 additions and 1 deletions
+42
View File
@@ -96,6 +96,48 @@ fn open_settings_command_opens_settings_page() -> Result<(), Box<dyn Error>> {
Ok(())
}
#[test]
fn settings_scoped_search_opens_matching_settings_page() -> Result<(), Box<dyn Error>> {
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
core.set_command_query("@settings sync");
let intent = core.submit_command()?;
let active_tab = core.active_tab()?;
assert_eq!(
intent,
Some(CommandIntent::ScopedSearch {
scope: CommandScope::Settings,
query: "sync".to_string()
})
);
assert_eq!(active_tab.title(), "Sync Settings");
assert_eq!(active_tab.url().as_str(), "ely://settings/sync");
assert_eq!(core.snapshot()?.command_query, "");
Ok(())
}
#[test]
fn settings_scoped_search_preserves_query_without_match() -> 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("@settings absent");
let intent = core.submit_command()?;
let snapshot = core.snapshot()?;
assert_eq!(
intent,
Some(CommandIntent::ScopedSearch {
scope: CommandScope::Settings,
query: "absent".to_string()
})
);
assert_eq!(snapshot.active_tab_id, active_tab_id);
assert_eq!(snapshot.command_query, "@settings absent");
Ok(())
}
#[test]
fn new_space_command_creates_and_selects_named_space() -> Result<(), Box<dyn Error>> {
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;