fune/browser/components/customizableui/test/browser_customizemode_contextmenu_menubuttonstate.js
Gijs Kruitbosch e69595b296 Bug 1256085 - fix hamburger menu losing pressed state when a context menu inside the panel closes, r=jaws
MozReview-Commit-ID: 6ZhBPlYMU4y

--HG--
extra : rebase_source : 3fd33fa6bc045ad62c9f355c4d0843b96a4d3149
2016-03-15 21:28:31 +00:00

24 lines
1.1 KiB
JavaScript

"use strict";
add_task(function*() {
ok(!PanelUI.menuButton.hasAttribute("open"), "Menu button should not be 'pressed' outside customize mode");
yield startCustomizing();
is(PanelUI.menuButton.getAttribute("open"), "true", "Menu button should be 'pressed' when in customize mode");
let contextMenu = document.getElementById("customizationPanelItemContextMenu");
let shownPromise = popupShown(contextMenu);
let newWindowButton = document.getElementById("wrapper-new-window-button");
EventUtils.synthesizeMouse(newWindowButton, 2, 2, {type: "contextmenu", button: 2});
yield shownPromise;
is(PanelUI.menuButton.getAttribute("open"), "true", "Menu button should be 'pressed' when in customize mode after opening a context menu");
let hiddenContextPromise = popupHidden(contextMenu);
contextMenu.hidePopup();
yield hiddenContextPromise;
is(PanelUI.menuButton.getAttribute("open"), "true", "Menu button should be 'pressed' when in customize mode after hiding a context menu");
yield endCustomizing();
ok(!PanelUI.menuButton.hasAttribute("open"), "Menu button should not be 'pressed' after ending customize mode");
});