Add privacy history settings
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use std::error::Error;
|
||||
|
||||
use ely_browser_core::{BrowserCore, InitialBrowserConfig};
|
||||
use ely_domain::{CommandIntent, CommandScope, ProfileKind, UrlText};
|
||||
use ely_domain::{CommandIntent, CommandScope, HistoryRecordingPolicy, ProfileKind, UrlText};
|
||||
|
||||
#[test]
|
||||
fn navigation_records_profile_and_space_history() -> Result<(), Box<dyn Error>> {
|
||||
@@ -30,6 +30,21 @@ fn internal_pages_are_omitted_from_history() -> Result<(), Box<dyn Error>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn paused_history_recording_skips_new_history_entries() -> Result<(), Box<dyn Error>> {
|
||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||
|
||||
core.open_tab(UrlText::parse("https://example.com/recorded")?);
|
||||
core.set_history_recording_policy(HistoryRecordingPolicy::Pause);
|
||||
core.open_tab(UrlText::parse("https://example.com/private")?);
|
||||
|
||||
let snapshot = core.snapshot()?;
|
||||
assert_eq!(snapshot.history_recording_policy, HistoryRecordingPolicy::Pause);
|
||||
assert_eq!(snapshot.history_entries.len(), 1);
|
||||
assert_eq!(snapshot.history_entries[0].url().as_str(), "https://example.com/recorded");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn history_scoped_search_opens_recent_matching_entry() -> Result<(), Box<dyn Error>> {
|
||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||
|
||||
@@ -107,3 +107,24 @@ fn settings_scoped_search_opens_search_page() -> Result<(), Box<dyn Error>> {
|
||||
assert_eq!(core.snapshot()?.command_query, "");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn settings_scoped_search_opens_privacy_security_page() -> Result<(), Box<dyn Error>> {
|
||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||
|
||||
core.set_command_query("@settings privacy");
|
||||
let intent = core.submit_command()?;
|
||||
let active_tab = core.active_tab()?;
|
||||
|
||||
assert_eq!(
|
||||
intent,
|
||||
Some(CommandIntent::ScopedSearch {
|
||||
scope: CommandScope::Settings,
|
||||
query: "privacy".to_string(),
|
||||
})
|
||||
);
|
||||
assert_eq!(active_tab.title(), "Privacy & Security Settings");
|
||||
assert_eq!(active_tab.url().as_str(), "ely://settings/privacy-security");
|
||||
assert_eq!(core.snapshot()?.command_query, "");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user