browser/components/customizableui/test/browser_909779_overflow_toolbars_new_window.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/customizableui/test/browser_909779_overflow_toolbars_new_window.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,31 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +"use strict";
     1.9 +
    1.10 +// Resize to a small window, open a new window, check that new window handles overflow properly
    1.11 +add_task(function() {
    1.12 +  let originalWindowWidth = window.outerWidth;
    1.13 +  let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
    1.14 +  ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
    1.15 +  let oldChildCount = navbar.customizationTarget.childElementCount;
    1.16 +  window.resizeTo(400, window.outerHeight);
    1.17 +  yield waitForCondition(() => navbar.hasAttribute("overflowing"));
    1.18 +  ok(navbar.hasAttribute("overflowing"), "Should have an overflowing toolbar.");
    1.19 +
    1.20 +  ok(navbar.customizationTarget.childElementCount < oldChildCount, "Should have fewer children.");
    1.21 +  let newWindow = yield openAndLoadWindow();
    1.22 +  let otherNavBar = newWindow.document.getElementById(CustomizableUI.AREA_NAVBAR);
    1.23 +  yield waitForCondition(() => otherNavBar.hasAttribute("overflowing"));
    1.24 +  ok(otherNavBar.hasAttribute("overflowing"), "Other window should have an overflowing toolbar.");
    1.25 +  yield promiseWindowClosed(newWindow);
    1.26 +
    1.27 +  window.resizeTo(originalWindowWidth, window.outerHeight);
    1.28 +  yield waitForCondition(() => !navbar.hasAttribute("overflowing"));
    1.29 +  ok(!navbar.hasAttribute("overflowing"), "Should no longer have an overflowing toolbar.");
    1.30 +});
    1.31 +
    1.32 +add_task(function asyncCleanup() {
    1.33 +  yield resetCustomization();
    1.34 +});

mercurial