browser_909779_overflow_toolbars_new_window.js (1768B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 // Resize to a small window, open a new window, check that new window handles overflow properly 8 add_task(async function () { 9 let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR); 10 ok( 11 !navbar.hasAttribute("overflowing"), 12 "Should start with a non-overflowing toolbar." 13 ); 14 ensureToolbarOverflow(window); 15 let oldChildCount = 16 CustomizableUI.getCustomizationTarget(navbar).childElementCount; 17 await TestUtils.waitForCondition(() => navbar.hasAttribute("overflowing")); 18 ok(navbar.hasAttribute("overflowing"), "Should have an overflowing toolbar."); 19 20 Assert.less( 21 CustomizableUI.getCustomizationTarget(navbar).childElementCount, 22 oldChildCount, 23 "Should have fewer children." 24 ); 25 let newWindow = await openAndLoadWindow(); 26 let otherNavBar = newWindow.document.getElementById( 27 CustomizableUI.AREA_NAVBAR 28 ); 29 await TestUtils.waitForCondition(() => 30 otherNavBar.hasAttribute("overflowing") 31 ); 32 ok( 33 otherNavBar.hasAttribute("overflowing"), 34 "Other window should have an overflowing toolbar." 35 ); 36 await promiseWindowClosed(newWindow); 37 38 // Wait until the `ensureToolbarOverflow` cleanup function has run before 39 // asserting the navbar is no longer overflowing. 40 registerCleanupFunction(async () => { 41 await TestUtils.waitForCondition(() => !navbar.hasAttribute("overflowing")); 42 ok( 43 !navbar.hasAttribute("overflowing"), 44 "Should no longer have an overflowing toolbar." 45 ); 46 }); 47 }); 48 49 add_task(async function asyncCleanup() { 50 await resetCustomization(); 51 });