browser/components/customizableui/test/browser_985815_propagate_setToolbarVisibility.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/customizableui/test/browser_985815_propagate_setToolbarVisibility.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     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 +add_task(function() {
    1.11 +  ok(CustomizableUI.inDefaultState, "Should start in default state.");
    1.12 +  this.otherWin = yield openAndLoadWindow({private: true}, true);
    1.13 +  yield startCustomizing(this.otherWin);
    1.14 +  let resetButton = this.otherWin.document.getElementById("customization-reset-button");
    1.15 +  ok(resetButton.disabled, "Reset button should be disabled");
    1.16 +
    1.17 +  if (typeof CustomizableUI.setToolbarVisibility == "function") {
    1.18 +    CustomizableUI.setToolbarVisibility("PersonalToolbar", true);
    1.19 +  } else {
    1.20 +    setToolbarVisibility(document.getElementById("PersonalToolbar"), true);
    1.21 +  }
    1.22 +
    1.23 +  let otherPersonalToolbar = this.otherWin.document.getElementById("PersonalToolbar");
    1.24 +  let personalToolbar = document.getElementById("PersonalToolbar");
    1.25 +  ok(!otherPersonalToolbar.collapsed, "Toolbar should be uncollapsed in private window");
    1.26 +  ok(!personalToolbar.collapsed, "Toolbar should be uncollapsed in normal window");
    1.27 +  ok(!resetButton.disabled, "Reset button should be enabled");
    1.28 +
    1.29 +  yield this.otherWin.gCustomizeMode.reset();
    1.30 +
    1.31 +  ok(otherPersonalToolbar.collapsed, "Toolbar should be collapsed in private window");
    1.32 +  ok(personalToolbar.collapsed, "Toolbar should be collapsed in normal window");
    1.33 +  ok(resetButton.disabled, "Reset button should be disabled");
    1.34 +
    1.35 +  yield endCustomizing(this.otherWin);
    1.36 +
    1.37 +  yield promiseWindowClosed(this.otherWin);
    1.38 +});
    1.39 +
    1.40 +
    1.41 +add_task(function asyncCleanup() {
    1.42 +  if (this.otherWin && !this.otherWin.closed) {
    1.43 +    yield promiseWindowClosed(this.otherWin);
    1.44 +  }
    1.45 +  if (!CustomizableUI.inDefaultState) {
    1.46 +    CustomizableUI.reset();
    1.47 +  }
    1.48 +});

mercurial