diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /browser/components/pocket/test/browser_pocket_panel_closemenu.js | |
parent | Initial commit. (diff) | |
download | firefox-esr-upstream.tar.xz firefox-esr-upstream.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/pocket/test/browser_pocket_panel_closemenu.js')
-rw-r--r-- | browser/components/pocket/test/browser_pocket_panel_closemenu.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/browser/components/pocket/test/browser_pocket_panel_closemenu.js b/browser/components/pocket/test/browser_pocket_panel_closemenu.js new file mode 100644 index 0000000000..b3a2f2d324 --- /dev/null +++ b/browser/components/pocket/test/browser_pocket_panel_closemenu.js @@ -0,0 +1,54 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +// This is testing the fix in bug 1729847, specifically +// clicking enter while the pocket panel is open should not close the panel. +add_task(async function () { + let tab = await BrowserTestUtils.openNewForegroundTab( + gBrowser, + "https://example.com/browser/browser/components/pocket/test/test.html" + ); + + info("clicking on pocket button in toolbar"); + let pocketButton = document.getElementById("save-to-pocket-button"); + // The panel is created on the fly, so we can't simply wait for focus + // inside it. + let pocketPanelShown = BrowserTestUtils.waitForEvent( + document, + "popupshown", + true + ); + pocketButton.click(); + await pocketPanelShown; + + let pocketPanel = document.getElementById("customizationui-widget-panel"); + let pocketFrame = pocketPanel.querySelector("browser"); + + // Ensure that the document layout has been flushed before triggering the focus event + // (See Bug 1519808 for a rationale). + await pocketFrame.ownerGlobal.promiseDocumentFlushed(() => {}); + + // The panelview should have closemenu="none". + // Without closemenu="none", the following sequence of + // frame focus then enter would close the panel, + // but we don't want it to close, we want it to stay open. + let focusEventPromise = BrowserTestUtils.waitForEvent(pocketFrame, "focus"); + pocketFrame.focus(); + await focusEventPromise; + EventUtils.synthesizeKey("VK_RETURN"); + + // Is the Pocket panel still open? + is(pocketPanel.state, "open", "pocket panel is open"); + + // We're done now, we can close the panel. + info("closing pocket panel"); + let pocketPanelHidden = BrowserTestUtils.waitForEvent( + pocketPanel, + "popuphidden" + ); + pocketPanel.hidePopup(); + await pocketPanelHidden; + + BrowserTestUtils.removeTab(tab); +}); |