Add general new tab settings

This commit is contained in:
2026-05-08 03:13:37 -04:00
parent 6750f60d52
commit 4bdbf5e0c5
14 changed files with 369 additions and 22 deletions
@@ -24,6 +24,27 @@ fn settings_scoped_search_opens_sidebar_tabs_page() -> Result<(), Box<dyn Error>
Ok(())
}
#[test]
fn settings_scoped_search_opens_general_page() -> Result<(), Box<dyn Error>> {
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
core.set_command_query("@settings general");
let intent = core.submit_command()?;
let active_tab = core.active_tab()?;
assert_eq!(
intent,
Some(CommandIntent::ScopedSearch {
scope: CommandScope::Settings,
query: "general".to_string(),
})
);
assert_eq!(active_tab.title(), "General Settings");
assert_eq!(active_tab.url().as_str(), "ely://settings/general");
assert_eq!(core.snapshot()?.command_query, "");
Ok(())
}
#[test]
fn settings_scoped_search_opens_shortcuts_page() -> Result<(), Box<dyn Error>> {
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
+18 -1
View File
@@ -1,7 +1,7 @@
use std::error::Error;
use ely_browser_core::{BrowserCore, CoreError, InitialBrowserConfig};
use ely_domain::{CommandIntent, CommandScope, SearchEngine, TabState, UrlText};
use ely_domain::{CommandIntent, CommandScope, NewTabDestination, SearchEngine, TabState, UrlText};
#[test]
fn opens_new_tab_below_active_tab() -> Result<(), Box<dyn Error>> {
@@ -260,6 +260,23 @@ fn search_command_uses_selected_search_engine() -> Result<(), Box<dyn Error>> {
Ok(())
}
#[test]
fn new_tab_command_uses_selected_destination() -> Result<(), Box<dyn Error>> {
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
core.set_new_tab_destination(NewTabDestination::Bookmarks);
core.set_command_query(">new-tab");
let intent = core.submit_command()?;
let active_tab = core.active_tab()?;
assert_eq!(intent, Some(CommandIntent::Command("new-tab".to_string())));
assert_eq!(active_tab.title(), "Bookmarks");
assert_eq!(active_tab.url().as_str(), "ely://bookmarks");
assert_eq!(core.snapshot()?.new_tab_destination, NewTabDestination::Bookmarks);
assert_eq!(core.command_query(), "");
Ok(())
}
#[test]
fn switching_spaces_restores_each_space_active_tab() -> Result<(), Box<dyn Error>> {
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;