browser_panel_toggle.js (1549B)
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.sys.mjs would) 12 add_task(async function () { 13 await gCUITestUtils.openMainMenu(); 14 15 is( 16 PanelUI.panel.getAttribute("panelopen"), 17 "true", 18 "Check that panel has panelopen attribute" 19 ); 20 is(PanelUI.panel.state, "open", "Check that panel state is 'open'"); 21 22 await gCUITestUtils.hideMainMenu(); 23 24 ok( 25 !PanelUI.panel.hasAttribute("panelopen"), 26 "Check that panel doesn't have the panelopen attribute" 27 ); 28 is(PanelUI.panel.state, "closed", "Check that panel state is 'closed'"); 29 }); 30 31 // Toggle the menu panel open and closed 32 add_task(async function () { 33 await gCUITestUtils.openPanelMultiView(PanelUI.panel, PanelUI.mainView, () => 34 PanelUI.toggle({ type: "command" }) 35 ); 36 37 is( 38 PanelUI.panel.getAttribute("panelopen"), 39 "true", 40 "Check that panel has panelopen attribute" 41 ); 42 is(PanelUI.panel.state, "open", "Check that panel state is 'open'"); 43 44 await gCUITestUtils.hidePanelMultiView(PanelUI.panel, () => 45 PanelUI.toggle({ type: "command" }) 46 ); 47 48 ok( 49 !PanelUI.panel.hasAttribute("panelopen"), 50 "Check that panel doesn't have the panelopen attribute" 51 ); 52 is(PanelUI.panel.state, "closed", "Check that panel state is 'closed'"); 53 });