summaryrefslogtreecommitdiffstats
path: root/browser/components/customizableui/test/browser_flexible_space_area.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /browser/components/customizableui/test/browser_flexible_space_area.js
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/customizableui/test/browser_flexible_space_area.js')
-rw-r--r--browser/components/customizableui/test/browser_flexible_space_area.js48
1 files changed, 48 insertions, 0 deletions
diff --git a/browser/components/customizableui/test/browser_flexible_space_area.js b/browser/components/customizableui/test/browser_flexible_space_area.js
new file mode 100644
index 0000000000..f3189096de
--- /dev/null
+++ b/browser/components/customizableui/test/browser_flexible_space_area.js
@@ -0,0 +1,48 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+function getSpringCount(area) {
+ return CustomizableUI.getWidgetIdsInArea(area).filter(id =>
+ id.includes("spring")
+ ).length;
+}
+
+/**
+ * Check that no matter where we add a flexible space, we
+ * never end up without a flexible space in the palette.
+ */
+add_task(async function test_flexible_space_addition() {
+ await startCustomizing();
+ let palette = document.getElementById("customization-palette");
+ // Make the bookmarks toolbar visible:
+ CustomizableUI.setToolbarVisibility(CustomizableUI.AREA_BOOKMARKS, true);
+ let areas = [CustomizableUI.AREA_NAVBAR, CustomizableUI.AREA_BOOKMARKS];
+ if (AppConstants.platform != "macosx") {
+ areas.push(CustomizableUI.AREA_MENUBAR);
+ }
+
+ for (let area of areas) {
+ let spacer = palette.querySelector("toolbarspring");
+ let toolbar = document.getElementById(area);
+ toolbar = CustomizableUI.getCustomizationTarget(toolbar);
+
+ let springCount = getSpringCount(area);
+ simulateItemDrag(spacer, toolbar);
+ // Check we added the spring:
+ is(
+ springCount + 1,
+ getSpringCount(area),
+ "Should now have an extra spring"
+ );
+
+ // Check there's still one in the palette:
+ let newSpacer = palette.querySelector("toolbarspring");
+ ok(newSpacer, "Should have created a new spring");
+ }
+});
+registerCleanupFunction(async function asyncCleanup() {
+ await endCustomizing();
+ await resetCustomization();
+});