browser/components/customizableui/test/browser_909779_overflow_toolbars_new_window.js

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:e23a553759a0
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(function() {
9 let originalWindowWidth = window.outerWidth;
10 let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
11 ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
12 let oldChildCount = navbar.customizationTarget.childElementCount;
13 window.resizeTo(400, window.outerHeight);
14 yield waitForCondition(() => navbar.hasAttribute("overflowing"));
15 ok(navbar.hasAttribute("overflowing"), "Should have an overflowing toolbar.");
16
17 ok(navbar.customizationTarget.childElementCount < oldChildCount, "Should have fewer children.");
18 let newWindow = yield openAndLoadWindow();
19 let otherNavBar = newWindow.document.getElementById(CustomizableUI.AREA_NAVBAR);
20 yield waitForCondition(() => otherNavBar.hasAttribute("overflowing"));
21 ok(otherNavBar.hasAttribute("overflowing"), "Other window should have an overflowing toolbar.");
22 yield promiseWindowClosed(newWindow);
23
24 window.resizeTo(originalWindowWidth, window.outerHeight);
25 yield waitForCondition(() => !navbar.hasAttribute("overflowing"));
26 ok(!navbar.hasAttribute("overflowing"), "Should no longer have an overflowing toolbar.");
27 });
28
29 add_task(function asyncCleanup() {
30 yield resetCustomization();
31 });

mercurial