|
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 /** |
|
8 * Test opening and closing the menu panel UI. |
|
9 */ |
|
10 |
|
11 // Show and hide the menu panel programmatically without an event (like UITour.jsm would) |
|
12 add_task(function() { |
|
13 let shownPromise = promisePanelShown(window); |
|
14 PanelUI.show(); |
|
15 yield shownPromise; |
|
16 |
|
17 is(PanelUI.panel.getAttribute("panelopen"), "true", "Check that panel has panelopen attribute"); |
|
18 is(PanelUI.panel.state, "open", "Check that panel state is 'open'"); |
|
19 |
|
20 let hiddenPromise = promisePanelHidden(window); |
|
21 PanelUI.hide(); |
|
22 yield hiddenPromise; |
|
23 |
|
24 ok(!PanelUI.panel.hasAttribute("panelopen"), "Check that panel doesn't have the panelopen attribute"); |
|
25 is(PanelUI.panel.state, "closed", "Check that panel state is 'closed'"); |
|
26 }); |
|
27 |
|
28 // Toggle the menu panel open and closed |
|
29 add_task(function() { |
|
30 let shownPromise = promisePanelShown(window); |
|
31 PanelUI.toggle({type: "command"}); |
|
32 yield shownPromise; |
|
33 |
|
34 is(PanelUI.panel.getAttribute("panelopen"), "true", "Check that panel has panelopen attribute"); |
|
35 is(PanelUI.panel.state, "open", "Check that panel state is 'open'"); |
|
36 |
|
37 let hiddenPromise = promisePanelHidden(window); |
|
38 PanelUI.toggle({type: "command"}); |
|
39 yield hiddenPromise; |
|
40 |
|
41 ok(!PanelUI.panel.hasAttribute("panelopen"), "Check that panel doesn't have the panelopen attribute"); |
|
42 is(PanelUI.panel.state, "closed", "Check that panel state is 'closed'"); |
|
43 }); |