From b1e860dea2b6982b4eada0f24035e5fd60e5b15b Mon Sep 17 00:00:00 2001 From: "Mr. M" Date: Wed, 15 Oct 2025 03:30:12 +0200 Subject: [PATCH] test: Fixed tests for welcome page and fixed QA issues, b=bug #10666, c=common, tabs, tests, welcome, workspaces --- prefs/zen/theme.yaml | 3 ++ .../CustomizableUI-sys-mjs.patch | 13 +++++---- src/zen/common/styles/zen-popup.css | 1 + .../common/styles/zen-single-components.css | 6 ++++ src/zen/tabs/zen-tabs/vertical-tabs.css | 28 ++++++++++++++----- .../tests/tabs/browser_tabs_fetch_checks.js | 4 +-- src/zen/tests/welcome/browser_welcome.js | 7 ++--- src/zen/workspaces/ZenGradientGenerator.mjs | 12 ++++++-- src/zen/workspaces/ZenWorkspaces.mjs | 7 +++++ 9 files changed, 60 insertions(+), 21 deletions(-) diff --git a/prefs/zen/theme.yaml b/prefs/zen/theme.yaml index 1fe3a6a88..afbc4ba01 100644 --- a/prefs/zen/theme.yaml +++ b/prefs/zen/theme.yaml @@ -35,6 +35,9 @@ - name: zen.theme.styled-status-panel value: '@IS_TWILIGHT@' +- name: zen.theme.hide-unified-extensions-button + value: false + # ==== Mark: border radius ==== # macOS border radius diff --git a/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch b/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch index 905c782ca..6625364c3 100644 --- a/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch +++ b/src/browser/components/customizableui/CustomizableUI-sys-mjs.patch @@ -1,5 +1,5 @@ diff --git a/browser/components/customizableui/CustomizableUI.sys.mjs b/browser/components/customizableui/CustomizableUI.sys.mjs -index d9a059f608779fea7cd8c595a432f6fe95183e0c..7f6493ced4abb1f6ba54242b8ee213a74f01aea5 100644 +index d9a059f608779fea7cd8c595a432f6fe95183e0c..97fbe5f7ac2c5bf18526528a8f50dcf4466fcafd 100644 --- a/browser/components/customizableui/CustomizableUI.sys.mjs +++ b/browser/components/customizableui/CustomizableUI.sys.mjs @@ -14,6 +14,7 @@ ChromeUtils.defineESModuleGetters(lazy, { @@ -177,17 +177,20 @@ index d9a059f608779fea7cd8c595a432f6fe95183e0c..7f6493ced4abb1f6ba54242b8ee213a7 return { isOverflowing, targetContentWidth, totalAvailWidth }; } -@@ -7970,7 +7971,8 @@ class OverflowableToolbar { +@@ -7970,7 +7971,11 @@ class OverflowableToolbar { return; } } - if (totalAvailWidth <= minSize) { -+ let isLastItem = win.gZenVerticalTabsManager._hasSetSingleToolbar && this.#target.id == 'zen-sidebar-top-buttons-customization-target' && this.#overflowedInfo.size == 1; ++ let isLastItem = win.gZenVerticalTabsManager._hasSetSingleToolbar && ++ this.#target.id == 'zen-sidebar-top-buttons-customization-target' && ++ this.#overflowedInfo.size == 1 && ++ !child.classList.contains('unified-extensions-item'); + if (totalAvailWidth <= minSize && !isLastItem) { lazy.log.debug( `Need ${minSize} but width is ${totalAvailWidth} so bailing` ); -@@ -8003,7 +8005,7 @@ class OverflowableToolbar { +@@ -8003,7 +8008,7 @@ class OverflowableToolbar { } } if (!inserted) { @@ -196,7 +199,7 @@ index d9a059f608779fea7cd8c595a432f6fe95183e0c..7f6493ced4abb1f6ba54242b8ee213a7 } child.removeAttribute("cui-anchorid"); child.removeAttribute("overflowedItem"); -@@ -8348,7 +8350,7 @@ class OverflowableToolbar { +@@ -8348,7 +8353,7 @@ class OverflowableToolbar { break; } case "mousedown": { diff --git a/src/zen/common/styles/zen-popup.css b/src/zen/common/styles/zen-popup.css index 755799ad3..55f3ac798 100644 --- a/src/zen/common/styles/zen-popup.css +++ b/src/zen/common/styles/zen-popup.css @@ -38,6 +38,7 @@ menupopup, panel { --panel-background: var(--arrowpanel-background); + --menuitem-padding: 6px !important; --panel-shadow-margin: 10px; /* This should match GetMenuCornerRadius() on macOS, or be overridden below */ diff --git a/src/zen/common/styles/zen-single-components.css b/src/zen/common/styles/zen-single-components.css index 4d78eccc9..62fdb7d78 100644 --- a/src/zen/common/styles/zen-single-components.css +++ b/src/zen/common/styles/zen-single-components.css @@ -466,6 +466,12 @@ body > #confetti { } } +@media (-moz-pref('zen.theme.hide-unified-extensions-button')) { + #unified-extensions-button { + display: none !important; + } +} + #unified-extensions-button:not([showing]) { display: none !important; } diff --git a/src/zen/tabs/zen-tabs/vertical-tabs.css b/src/zen/tabs/zen-tabs/vertical-tabs.css index 40585a8ca..4220c5375 100644 --- a/src/zen/tabs/zen-tabs/vertical-tabs.css +++ b/src/zen/tabs/zen-tabs/vertical-tabs.css @@ -1149,11 +1149,28 @@ position: relative; --zen-essential-bg-margin: 2px; - &::before { - background: light-dark( + --zen-essential-tab-selected-bg: light-dark( + rgba(255, 255, 255, 0.85), + color-mix(in srgb, var(--zen-primary-color), rgba(68, 64, 64, 0.85) 40%) + ); + --zen-essential-tab-selected-bg-hover: light-dark( + rgba(255, 255, 255, 0.8), + color-mix(in srgb, var(--zen-primary-color), rgba(68, 64, 64, 0.85) 50%) + ); + + :root[zen-default-theme='true'] & { + --zen-essential-tab-selected-bg: light-dark( rgba(255, 255, 255, 0.85), - color-mix(in srgb, var(--zen-primary-color), rgba(68, 64, 64, 0.85) 40%) + rgba(68, 64, 64, 0.85) ); + --zen-essential-tab-selected-bg-hover: light-dark( + rgba(255, 255, 255, 0.8), + rgba(68, 64, 64, 0.75) + ); + } + + &::before { + background: var(--zen-essential-tab-selected-bg); margin: var(--zen-essential-bg-margin); border-radius: calc(var(--border-radius-medium) - var(--zen-essential-bg-margin)); position: absolute; @@ -1165,10 +1182,7 @@ } &[visuallyselected]:hover .tab-background::before { - background: light-dark( - rgba(255, 255, 255, 0.8), - color-mix(in srgb, var(--zen-primary-color), rgba(68, 64, 64, 0.85) 50%) - ); + background: var(--zen-essential-tab-selected-bg-hover); } } } diff --git a/src/zen/tests/tabs/browser_tabs_fetch_checks.js b/src/zen/tests/tabs/browser_tabs_fetch_checks.js index a223af8b0..db6fa0f81 100644 --- a/src/zen/tests/tabs/browser_tabs_fetch_checks.js +++ b/src/zen/tests/tabs/browser_tabs_fetch_checks.js @@ -23,7 +23,7 @@ add_task(async function test_Aria_Focusable_Tabs() { } Assert.equal( gBrowser.tabContainer.ariaFocusableItems.length, - 2, - 'There should be 2 focusable tabs (1 empty tab + 1 about:blank tab) at startup' + 1, + 'There should be 1 focusable tab (1 about:blank tab) at startup' ); }); diff --git a/src/zen/tests/welcome/browser_welcome.js b/src/zen/tests/welcome/browser_welcome.js index b5302ae58..d780ce9f1 100644 --- a/src/zen/tests/welcome/browser_welcome.js +++ b/src/zen/tests/welcome/browser_welcome.js @@ -43,7 +43,6 @@ add_task(async function test_Welcome_Steps() { ); for (const child of welcomeContent.children) { - console.log(child); ok( child.querySelector('img').getAttribute('src').includes('blob:'), 'Welcome page content should have an image with a base64 data URL' @@ -66,7 +65,7 @@ add_task(async function test_Welcome_Steps() { }, 100); // Wait for the transition to complete }); - await goNextWelcomePage('zen-welcome-next-action'); + await goNextWelcomePage('zen-generic-next'); ok(true, 'Welcome Search Step Test Finished'); await new Promise((resolve) => { @@ -103,7 +102,7 @@ add_task(async function test_Welcome_Steps() { ok(url.startsWith('https://'), `The URL "${url}" should start with "https://"`); } - await goNextWelcomePage('zen-welcome-next-action'); + await goNextWelcomePage('zen-generic-next'); await new Promise((resolve) => { setTimeout(async () => { @@ -120,7 +119,7 @@ add_task(async function test_Welcome_Steps() { }, 1000); // Wait for the transition to complete }); - await goNextWelcomePage('zen-welcome-next-action'); + await goNextWelcomePage('zen-generic-next'); ok(true, 'Welcome Theme Step Test Finished'); await goNextWelcomePage('zen-welcome-start-browsing'); diff --git a/src/zen/workspaces/ZenGradientGenerator.mjs b/src/zen/workspaces/ZenGradientGenerator.mjs index d897442c5..6a7591340 100644 --- a/src/zen/workspaces/ZenGradientGenerator.mjs +++ b/src/zen/workspaces/ZenGradientGenerator.mjs @@ -1470,9 +1470,15 @@ gradient ); const isDarkModeWindow = browser.gZenThemePicker.isDarkMode; + const docElement = browser.document.documentElement; + if (isDefaultTheme) { + docElement.setAttribute('zen-default-theme', 'true'); + } else { + docElement.removeAttribute('zen-default-theme'); + } if (dominantColor) { const primaryColor = this.getAccentColorForUI(dominantColor); - browser.document.documentElement.style.setProperty('--zen-primary-color', primaryColor); + docElement.style.setProperty('--zen-primary-color', primaryColor); // Should be set to `this.isLegacyVersion` but for some reason it is set to undefined if we open a private window, // so instead get the pref value directly. @@ -1483,10 +1489,10 @@ if (!isDefaultTheme && !this.isLegacyVersion) { // Check for the primary color isDarkMode = browser.gZenThemePicker.shouldBeDarkMode(dominantColor); - browser.document.documentElement.setAttribute('zen-should-be-dark-mode', isDarkMode); + docElement.setAttribute('zen-should-be-dark-mode', isDarkMode); browser.gZenThemePicker.panel.removeAttribute('invalidate-controls'); } else { - browser.document.documentElement.removeAttribute('zen-should-be-dark-mode'); + docElement.removeAttribute('zen-should-be-dark-mode'); if (!this.isLegacyVersion) { browser.gZenThemePicker.panel.setAttribute('invalidate-controls', 'true'); } diff --git a/src/zen/workspaces/ZenWorkspaces.mjs b/src/zen/workspaces/ZenWorkspaces.mjs index 53378d6a8..7e41bfc8d 100644 --- a/src/zen/workspaces/ZenWorkspaces.mjs +++ b/src/zen/workspaces/ZenWorkspaces.mjs @@ -2181,6 +2181,13 @@ var gZenWorkspaces = new (class extends nsZenMultiWindowFeature { return true; // Always show glance tabs } + // See https://github.com/zen-browser/desktop/issues/10666, we should never + // show closing tabs and consider them as not part of any workspace. This will + // invalidate the `lastSelectedTab[previousWorkspaceId]` logic in `_handleTabSelection` + if (tab.closing) { + return false; // Never show closing tabs + } + // Handle essential tabs if (isEssential) { if (!this.containerSpecificEssentials) {