From ccb3972b75288ce21e13622e4bbf9e3bf54b54c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=B7=E7=94=B5=E8=8A=BD=E8=A1=A3?= Date: Fri, 8 May 2026 01:36:56 -0400 Subject: [PATCH] Add archive page command --- crates/ely_browser_core/src/navigation.rs | 4 ++++ crates/ely_browser_core/src/state/commands.rs | 6 +++++- crates/ely_browser_core/tests/archive.rs | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 crates/ely_browser_core/tests/archive.rs diff --git a/crates/ely_browser_core/src/navigation.rs b/crates/ely_browser_core/src/navigation.rs index 55dd641..dc7f89f 100644 --- a/crates/ely_browser_core/src/navigation.rs +++ b/crates/ely_browser_core/src/navigation.rs @@ -106,6 +106,10 @@ pub(crate) fn history_url() -> Result { internal_page_url("ely://history") } +pub(crate) fn archive_url() -> Result { + internal_page_url("ely://archive") +} + pub(crate) fn task_manager_url() -> Result { internal_page_url("ely://task-manager") } diff --git a/crates/ely_browser_core/src/state/commands.rs b/crates/ely_browser_core/src/state/commands.rs index 04347fc..2f1b155 100644 --- a/crates/ely_browser_core/src/state/commands.rs +++ b/crates/ely_browser_core/src/state/commands.rs @@ -3,7 +3,7 @@ use ely_domain::{CommandIntent, CommandScope, ProfileId, ProfileKind, SpaceId}; use crate::{ CoreError, navigation::{ - about_url, bookmarks_url, downloads_url, history_url, move_tab_space_name, + about_url, archive_url, bookmarks_url, downloads_url, history_url, move_tab_space_name, new_private_profile_name, new_profile_name, new_space_name, plugin_detail_url, plugins_url, reading_list_url, search_url, settings_page_url, settings_url, space_icon, switch_profile_name, sync_status_url, task_manager_url, @@ -137,6 +137,10 @@ impl BrowserCore { self.open_tab(history_url()?); Ok(true) } + "archive" | "open-archive" | "open archive" => { + self.open_tab(archive_url()?); + Ok(true) + } "task-manager" | "tasks" | "open-task-manager" | "open task manager" => { self.open_tab(task_manager_url()?); Ok(true) diff --git a/crates/ely_browser_core/tests/archive.rs b/crates/ely_browser_core/tests/archive.rs new file mode 100644 index 0000000..de079d2 --- /dev/null +++ b/crates/ely_browser_core/tests/archive.rs @@ -0,0 +1,19 @@ +use std::error::Error; + +use ely_browser_core::{BrowserCore, InitialBrowserConfig}; +use ely_domain::CommandIntent; + +#[test] +fn open_archive_command_opens_archive_page() -> Result<(), Box> { + let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?; + + core.set_command_query(">open-archive"); + let intent = core.submit_command()?; + let active_tab = core.active_tab()?; + + assert_eq!(intent, Some(CommandIntent::Command("open-archive".to_string()))); + assert_eq!(active_tab.title(), "Archived Tabs"); + assert_eq!(active_tab.url().as_str(), "ely://archive"); + assert_eq!(core.snapshot()?.command_query, ""); + Ok(()) +}