summaryrefslogtreecommitdiffstats
path: root/browser/components/customizableui/test/browser_884402_customize_from_overflow.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /browser/components/customizableui/test/browser_884402_customize_from_overflow.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'browser/components/customizableui/test/browser_884402_customize_from_overflow.js')
-rw-r--r--browser/components/customizableui/test/browser_884402_customize_from_overflow.js81
1 files changed, 81 insertions, 0 deletions
diff --git a/browser/components/customizableui/test/browser_884402_customize_from_overflow.js b/browser/components/customizableui/test/browser_884402_customize_from_overflow.js
new file mode 100644
index 000000000..f50767c06
--- /dev/null
+++ b/browser/components/customizableui/test/browser_884402_customize_from_overflow.js
@@ -0,0 +1,81 @@
+"use strict";
+
+var overflowPanel = document.getElementById("widget-overflow");
+
+const isOSX = (Services.appinfo.OS === "Darwin");
+
+var originalWindowWidth;
+registerCleanupFunction(function() {
+ overflowPanel.removeAttribute("animate");
+ window.resizeTo(originalWindowWidth, window.outerHeight);
+});
+
+// Right-click on an item within the overflow panel should
+// show a context menu with options to move it.
+add_task(function*() {
+
+ overflowPanel.setAttribute("animate", "false");
+
+ originalWindowWidth = window.outerWidth;
+ let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
+ ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
+ window.resizeTo(400, window.outerHeight);
+
+ yield waitForCondition(() => navbar.hasAttribute("overflowing"));
+ ok(navbar.hasAttribute("overflowing"), "Should have an overflowing toolbar.");
+
+ let chevron = document.getElementById("nav-bar-overflow-button");
+ let shownPanelPromise = promisePanelElementShown(window, overflowPanel);
+ chevron.click();
+ yield shownPanelPromise;
+
+ let contextMenu = document.getElementById("toolbar-context-menu");
+ let shownContextPromise = popupShown(contextMenu);
+ let homeButton = document.getElementById("home-button");
+ ok(homeButton, "home-button was found");
+ is(homeButton.getAttribute("overflowedItem"), "true", "Home button is overflowing");
+ EventUtils.synthesizeMouse(homeButton, 2, 2, {type: "contextmenu", button: 2});
+ yield shownContextPromise;
+
+ is(overflowPanel.state, "open", "The widget overflow panel should still be open.");
+
+ let expectedEntries = [
+ [".customize-context-moveToPanel", true],
+ [".customize-context-removeFromToolbar", true],
+ ["---"]
+ ];
+ if (!isOSX) {
+ expectedEntries.push(["#toggle_toolbar-menubar", true]);
+ }
+ expectedEntries.push(
+ ["#toggle_PersonalToolbar", true],
+ ["---"],
+ [".viewCustomizeToolbar", true]
+ );
+ checkContextMenu(contextMenu, expectedEntries);
+
+ let hiddenContextPromise = popupHidden(contextMenu);
+ let hiddenPromise = promisePanelElementHidden(window, overflowPanel);
+ let moveToPanel = contextMenu.querySelector(".customize-context-moveToPanel");
+ if (moveToPanel) {
+ moveToPanel.click();
+ }
+ contextMenu.hidePopup();
+ yield hiddenContextPromise;
+ yield hiddenPromise;
+
+ let homeButtonPlacement = CustomizableUI.getPlacementOfWidget("home-button");
+ ok(homeButtonPlacement, "Home button should still have a placement");
+ is(homeButtonPlacement && homeButtonPlacement.area, "PanelUI-contents", "Home button should be in the panel now");
+ CustomizableUI.reset();
+
+ // In some cases, it can take a tick for the navbar to overflow again. Wait for it:
+ yield waitForCondition(() => navbar.hasAttribute("overflowing"));
+ ok(navbar.hasAttribute("overflowing"), "Should have an overflowing toolbar.");
+
+ homeButtonPlacement = CustomizableUI.getPlacementOfWidget("home-button");
+ ok(homeButtonPlacement, "Home button should still have a placement");
+ is(homeButtonPlacement && homeButtonPlacement.area, "nav-bar", "Home button should be back in the navbar now");
+
+ is(homeButton.getAttribute("overflowedItem"), "true", "Home button should still be overflowed");
+});