browser/components/customizableui/test/browser_985815_propagate_setToolbarVisibility.js

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:a4a8d22adca8
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 add_task(function() {
8 ok(CustomizableUI.inDefaultState, "Should start in default state.");
9 this.otherWin = yield openAndLoadWindow({private: true}, true);
10 yield startCustomizing(this.otherWin);
11 let resetButton = this.otherWin.document.getElementById("customization-reset-button");
12 ok(resetButton.disabled, "Reset button should be disabled");
13
14 if (typeof CustomizableUI.setToolbarVisibility == "function") {
15 CustomizableUI.setToolbarVisibility("PersonalToolbar", true);
16 } else {
17 setToolbarVisibility(document.getElementById("PersonalToolbar"), true);
18 }
19
20 let otherPersonalToolbar = this.otherWin.document.getElementById("PersonalToolbar");
21 let personalToolbar = document.getElementById("PersonalToolbar");
22 ok(!otherPersonalToolbar.collapsed, "Toolbar should be uncollapsed in private window");
23 ok(!personalToolbar.collapsed, "Toolbar should be uncollapsed in normal window");
24 ok(!resetButton.disabled, "Reset button should be enabled");
25
26 yield this.otherWin.gCustomizeMode.reset();
27
28 ok(otherPersonalToolbar.collapsed, "Toolbar should be collapsed in private window");
29 ok(personalToolbar.collapsed, "Toolbar should be collapsed in normal window");
30 ok(resetButton.disabled, "Reset button should be disabled");
31
32 yield endCustomizing(this.otherWin);
33
34 yield promiseWindowClosed(this.otherWin);
35 });
36
37
38 add_task(function asyncCleanup() {
39 if (this.otherWin && !this.otherWin.closed) {
40 yield promiseWindowClosed(this.otherWin);
41 }
42 if (!CustomizableUI.inDefaultState) {
43 CustomizableUI.reset();
44 }
45 });

mercurial