Add downloads settings page

This commit is contained in:
2026-05-08 03:24:59 -04:00
parent 6ba7fd611c
commit e2d8b0cc6e
8 changed files with 336 additions and 2 deletions
@@ -176,6 +176,26 @@ fn records_active_profile_download_policy_on_started_entry() -> Result<(), Box<d
Ok(())
}
#[test]
fn active_profile_download_policy_updates_started_entries() -> Result<(), Box<dyn Error>> {
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
let policy = DownloadPolicy::fixed_directory("/tmp/ely-active-downloads")?;
core.set_active_profile_download_policy(policy.clone())?;
core.record_download_started(
UrlText::parse("https://example.com/manual.pdf")?,
"manual.pdf",
Some(1024),
)?;
let snapshot = core.snapshot()?;
let entry = active_download(&core)?;
assert_eq!(snapshot.active_download_policy, policy);
assert_eq!(entry.destination(), policy.destination());
assert_eq!(entry.target_file_path(), Some(Path::new("/tmp/ely-active-downloads/manual.pdf")));
Ok(())
}
#[test]
fn confirms_dangerous_download_security_prompt() -> Result<(), Box<dyn Error>> {
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
@@ -128,3 +128,24 @@ fn settings_scoped_search_opens_privacy_security_page() -> Result<(), Box<dyn Er
assert_eq!(core.snapshot()?.command_query, "");
Ok(())
}
#[test]
fn settings_scoped_search_opens_downloads_page() -> Result<(), Box<dyn Error>> {
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
core.set_command_query("@settings downloads");
let intent = core.submit_command()?;
let active_tab = core.active_tab()?;
assert_eq!(
intent,
Some(CommandIntent::ScopedSearch {
scope: CommandScope::Settings,
query: "downloads".to_string(),
})
);
assert_eq!(active_tab.title(), "Downloads Settings");
assert_eq!(active_tab.url().as_str(), "ely://settings/downloads");
assert_eq!(core.snapshot()?.command_query, "");
Ok(())
}