summaryrefslogtreecommitdiffstats
path: root/browser/components/customizableui/test/browser_allow_dragging_removable_false.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/customizableui/test/browser_allow_dragging_removable_false.js')
-rw-r--r--browser/components/customizableui/test/browser_allow_dragging_removable_false.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/browser/components/customizableui/test/browser_allow_dragging_removable_false.js b/browser/components/customizableui/test/browser_allow_dragging_removable_false.js
new file mode 100644
index 0000000000..76269f44ae
--- /dev/null
+++ b/browser/components/customizableui/test/browser_allow_dragging_removable_false.js
@@ -0,0 +1,42 @@
+"use strict";
+
+/**
+ * Test dragging a removable=false widget within its own area as well as to the palette.
+ */
+add_task(async function () {
+ await startCustomizing();
+ let forwardButton = document.getElementById("forward-button");
+ is(
+ forwardButton.getAttribute("removable"),
+ "false",
+ "forward-button should not be removable"
+ );
+ ok(CustomizableUI.inDefaultState, "Should start in default state.");
+
+ let urlbarContainer = document.getElementById("urlbar-container");
+ let placementsAfterDrag = getAreaWidgetIds(CustomizableUI.AREA_NAVBAR);
+ placementsAfterDrag.splice(placementsAfterDrag.indexOf("forward-button"), 1);
+ placementsAfterDrag.splice(
+ placementsAfterDrag.indexOf("urlbar-container"),
+ 0,
+ "forward-button"
+ );
+
+ // Force layout flush to ensure the drag completes as expected
+ urlbarContainer.clientWidth;
+
+ simulateItemDrag(forwardButton, urlbarContainer, "start");
+ assertAreaPlacements(CustomizableUI.AREA_NAVBAR, placementsAfterDrag);
+ ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
+ let palette = document.getElementById("customization-palette");
+ simulateItemDrag(forwardButton, palette);
+ is(
+ CustomizableUI.getPlacementOfWidget("forward-button").area,
+ CustomizableUI.AREA_NAVBAR,
+ "forward-button was not able to move to palette"
+ );
+
+ await endCustomizing();
+ await resetCustomization();
+ ok(CustomizableUI.inDefaultState, "Should be in default state again.");
+});