Add auth callback internal page
This commit is contained in:
@@ -25,6 +25,7 @@ fn internal_page_title(url: &str) -> Option<&'static str> {
|
||||
"ely://task-manager" => Some("Task Manager"),
|
||||
"ely://site-compatibility" => Some("Site Compatibility"),
|
||||
"ely://plugins" => Some("Plugin Marketplace"),
|
||||
url if auth_callback_route(url) => Some("Auth Callback"),
|
||||
url if crash_route_tab_id(url).is_some() => Some("Tab Recovery"),
|
||||
url if plugin_detail_route_id(url).is_some() => Some("Plugin Details"),
|
||||
url if SiteOrigin::from_site_route(url).ok().flatten().is_some() => Some("Site Settings"),
|
||||
@@ -486,3 +487,7 @@ pub(crate) fn crash_route_tab_id(url: &str) -> Option<&str> {
|
||||
let tab_id = url.strip_prefix("ely://crash/")?;
|
||||
(!tab_id.is_empty() && !tab_id.contains('/')).then_some(tab_id)
|
||||
}
|
||||
|
||||
fn auth_callback_route(url: &str) -> bool {
|
||||
matches!(url, "ely://auth/callback") || url.starts_with("ely://auth/callback?")
|
||||
}
|
||||
|
||||
@@ -72,6 +72,19 @@ fn opened_tabs_record_active_tab_as_parent() -> Result<(), Box<dyn Error>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn auth_callback_tabs_receive_internal_title() -> Result<(), Box<dyn Error>> {
|
||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||
|
||||
let tab_id = core.open_tab(UrlText::parse("ely://auth/callback?code=abc")?);
|
||||
let snapshot = core.snapshot()?;
|
||||
let tab =
|
||||
snapshot.tabs.iter().find(|tab| tab.id() == &tab_id).ok_or(CoreError::MissingActiveTab)?;
|
||||
|
||||
assert_eq!(tab.title(), "Auth Callback");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn replacement_tabs_have_no_parent_tab() -> Result<(), Box<dyn Error>> {
|
||||
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
|
||||
|
||||
Reference in New Issue
Block a user