michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: "use strict"; michael@0: michael@0: /** michael@0: * Test opening and closing the menu panel UI. michael@0: */ michael@0: michael@0: // Show and hide the menu panel programmatically without an event (like UITour.jsm would) michael@0: add_task(function() { michael@0: let shownPromise = promisePanelShown(window); michael@0: PanelUI.show(); michael@0: yield shownPromise; michael@0: michael@0: is(PanelUI.panel.getAttribute("panelopen"), "true", "Check that panel has panelopen attribute"); michael@0: is(PanelUI.panel.state, "open", "Check that panel state is 'open'"); michael@0: michael@0: let hiddenPromise = promisePanelHidden(window); michael@0: PanelUI.hide(); michael@0: yield hiddenPromise; michael@0: michael@0: ok(!PanelUI.panel.hasAttribute("panelopen"), "Check that panel doesn't have the panelopen attribute"); michael@0: is(PanelUI.panel.state, "closed", "Check that panel state is 'closed'"); michael@0: }); michael@0: michael@0: // Toggle the menu panel open and closed michael@0: add_task(function() { michael@0: let shownPromise = promisePanelShown(window); michael@0: PanelUI.toggle({type: "command"}); michael@0: yield shownPromise; michael@0: michael@0: is(PanelUI.panel.getAttribute("panelopen"), "true", "Check that panel has panelopen attribute"); michael@0: is(PanelUI.panel.state, "open", "Check that panel state is 'open'"); michael@0: michael@0: let hiddenPromise = promisePanelHidden(window); michael@0: PanelUI.toggle({type: "command"}); michael@0: yield hiddenPromise; michael@0: michael@0: ok(!PanelUI.panel.hasAttribute("panelopen"), "Check that panel doesn't have the panelopen attribute"); michael@0: is(PanelUI.panel.state, "closed", "Check that panel state is 'closed'"); michael@0: });