From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../browser_909779_overflow_toolbars_new_window.js | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 browser/components/customizableui/test/browser_909779_overflow_toolbars_new_window.js (limited to 'browser/components/customizableui/test/browser_909779_overflow_toolbars_new_window.js') diff --git a/browser/components/customizableui/test/browser_909779_overflow_toolbars_new_window.js b/browser/components/customizableui/test/browser_909779_overflow_toolbars_new_window.js new file mode 100644 index 0000000000..bca9a05b94 --- /dev/null +++ b/browser/components/customizableui/test/browser_909779_overflow_toolbars_new_window.js @@ -0,0 +1,49 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +// Resize to a small window, open a new window, check that new window handles overflow properly +add_task(async function () { + let originalWindowWidth = window.outerWidth; + let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR); + ok( + !navbar.hasAttribute("overflowing"), + "Should start with a non-overflowing toolbar." + ); + let oldChildCount = + CustomizableUI.getCustomizationTarget(navbar).childElementCount; + window.resizeTo(kForceOverflowWidthPx, window.outerHeight); + await TestUtils.waitForCondition(() => navbar.hasAttribute("overflowing")); + ok(navbar.hasAttribute("overflowing"), "Should have an overflowing toolbar."); + + ok( + CustomizableUI.getCustomizationTarget(navbar).childElementCount < + oldChildCount, + "Should have fewer children." + ); + let newWindow = await openAndLoadWindow(); + let otherNavBar = newWindow.document.getElementById( + CustomizableUI.AREA_NAVBAR + ); + await TestUtils.waitForCondition(() => + otherNavBar.hasAttribute("overflowing") + ); + ok( + otherNavBar.hasAttribute("overflowing"), + "Other window should have an overflowing toolbar." + ); + await promiseWindowClosed(newWindow); + + window.resizeTo(originalWindowWidth, window.outerHeight); + await TestUtils.waitForCondition(() => !navbar.hasAttribute("overflowing")); + ok( + !navbar.hasAttribute("overflowing"), + "Should no longer have an overflowing toolbar." + ); +}); + +add_task(async function asyncCleanup() { + await resetCustomization(); +}); -- cgit v1.2.3