Add archive page command
This commit is contained in:
@@ -106,6 +106,10 @@ pub(crate) fn history_url() -> Result<UrlText, CoreError> {
|
|||||||
internal_page_url("ely://history")
|
internal_page_url("ely://history")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn archive_url() -> Result<UrlText, CoreError> {
|
||||||
|
internal_page_url("ely://archive")
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn task_manager_url() -> Result<UrlText, CoreError> {
|
pub(crate) fn task_manager_url() -> Result<UrlText, CoreError> {
|
||||||
internal_page_url("ely://task-manager")
|
internal_page_url("ely://task-manager")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ use ely_domain::{CommandIntent, CommandScope, ProfileId, ProfileKind, SpaceId};
|
|||||||
use crate::{
|
use crate::{
|
||||||
CoreError,
|
CoreError,
|
||||||
navigation::{
|
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,
|
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,
|
reading_list_url, search_url, settings_page_url, settings_url, space_icon,
|
||||||
switch_profile_name, sync_status_url, task_manager_url,
|
switch_profile_name, sync_status_url, task_manager_url,
|
||||||
@@ -137,6 +137,10 @@ impl BrowserCore {
|
|||||||
self.open_tab(history_url()?);
|
self.open_tab(history_url()?);
|
||||||
Ok(true)
|
Ok(true)
|
||||||
}
|
}
|
||||||
|
"archive" | "open-archive" | "open archive" => {
|
||||||
|
self.open_tab(archive_url()?);
|
||||||
|
Ok(true)
|
||||||
|
}
|
||||||
"task-manager" | "tasks" | "open-task-manager" | "open task manager" => {
|
"task-manager" | "tasks" | "open-task-manager" | "open task manager" => {
|
||||||
self.open_tab(task_manager_url()?);
|
self.open_tab(task_manager_url()?);
|
||||||
Ok(true)
|
Ok(true)
|
||||||
|
|||||||
@@ -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<dyn Error>> {
|
||||||
|
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(())
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user