diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /browser/components/customizableui/test/browser_1008559_anchor_undo_restore.js | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/customizableui/test/browser_1008559_anchor_undo_restore.js')
-rw-r--r-- | browser/components/customizableui/test/browser_1008559_anchor_undo_restore.js | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/browser/components/customizableui/test/browser_1008559_anchor_undo_restore.js b/browser/components/customizableui/test/browser_1008559_anchor_undo_restore.js new file mode 100644 index 0000000000..a7da97cc95 --- /dev/null +++ b/browser/components/customizableui/test/browser_1008559_anchor_undo_restore.js @@ -0,0 +1,102 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +const kAnchorAttribute = "cui-anchorid"; + +/** + * Check that anchor gets set correctly when moving an item from the panel to the toolbar + * and into the palette. + */ +add_task(async function () { + CustomizableUI.addWidgetToArea( + "history-panelmenu", + CustomizableUI.AREA_FIXED_OVERFLOW_PANEL + ); + await startCustomizing(); + let button = document.getElementById("history-panelmenu"); + is( + button.getAttribute(kAnchorAttribute), + "nav-bar-overflow-button", + "Button (" + button.id + ") starts out with correct anchor" + ); + + let navbar = CustomizableUI.getCustomizationTarget( + document.getElementById("nav-bar") + ); + let onMouseUp = BrowserTestUtils.waitForEvent(navbar, "mouseup"); + simulateItemDrag(button, navbar); + await onMouseUp; + is( + CustomizableUI.getPlacementOfWidget(button.id).area, + "nav-bar", + "Button (" + button.id + ") ends up in nav-bar" + ); + + ok( + !button.hasAttribute(kAnchorAttribute), + "Button (" + button.id + ") has no anchor in toolbar" + ); + + CustomizableUI.addWidgetToArea( + "history-panelmenu", + CustomizableUI.AREA_FIXED_OVERFLOW_PANEL + ); + + is( + button.getAttribute(kAnchorAttribute), + "nav-bar-overflow-button", + "Button (" + button.id + ") has anchor again" + ); + + let resetButton = document.getElementById("customization-reset-button"); + ok(!resetButton.hasAttribute("disabled"), "Should be able to reset now."); + await gCustomizeMode.reset(); + + ok( + !button.hasAttribute(kAnchorAttribute), + "Button (" + button.id + ") once again has no anchor in customize panel" + ); + + await endCustomizing(); +}); + +/** + * Check that anchor gets set correctly when moving an item from the panel to the toolbar + * using 'reset' + */ +add_task(async function () { + await startCustomizing(); + let button = document.getElementById("stop-reload-button"); + ok( + !button.hasAttribute(kAnchorAttribute), + "Button (" + button.id + ") has no anchor in toolbar" + ); + + let panel = document.getElementById(CustomizableUI.AREA_FIXED_OVERFLOW_PANEL); + let onMouseUp = BrowserTestUtils.waitForEvent(panel, "mouseup"); + simulateItemDrag(button, panel); + await onMouseUp; + is( + CustomizableUI.getPlacementOfWidget(button.id).area, + CustomizableUI.AREA_FIXED_OVERFLOW_PANEL, + "Button (" + button.id + ") ends up in panel" + ); + is( + button.getAttribute(kAnchorAttribute), + "nav-bar-overflow-button", + "Button (" + button.id + ") has correct anchor in the panel" + ); + + let resetButton = document.getElementById("customization-reset-button"); + ok(!resetButton.hasAttribute("disabled"), "Should be able to reset now."); + await gCustomizeMode.reset(); + + ok( + !button.hasAttribute(kAnchorAttribute), + "Button (" + button.id + ") once again has no anchor in toolbar" + ); + + await endCustomizing(); +}); |