diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /toolkit/content/tests/browser/browser_bug1693577.js | |
parent | Initial commit. (diff) | |
download | firefox-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 'toolkit/content/tests/browser/browser_bug1693577.js')
-rw-r--r-- | toolkit/content/tests/browser/browser_bug1693577.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/toolkit/content/tests/browser/browser_bug1693577.js b/toolkit/content/tests/browser/browser_bug1693577.js new file mode 100644 index 0000000000..13c21f4416 --- /dev/null +++ b/toolkit/content/tests/browser/browser_bug1693577.js @@ -0,0 +1,49 @@ +/* + * This test checks that the popupshowing event for input fields, which do not + * have a dedicated contextmenu event, but use the global one (added by + * editMenuOverlay.js, see bug 1693577) include a triggerNode. + * + * The search-input field of the browser-sidebar is one of the rare cases in + * mozilla-central, which can be used to test this. There are a few more in + * comm-central, which need the triggerNode information. + */ + +add_task(async function test_search_input_popupshowing() { + let sidebar = document.getElementById("sidebar"); + + let loadPromise = BrowserTestUtils.waitForEvent(sidebar, "load", true); + SidebarUI.toggle("viewBookmarksSidebar"); + await loadPromise; + + let inputField = sidebar.contentDocument.getElementById("search-box") + .inputField; + const popupshowing = BrowserTestUtils.waitForEvent( + sidebar.contentWindow, + "popupshowing" + ); + + EventUtils.synthesizeMouseAtCenter( + inputField, + { + type: "contextmenu", + button: 2, + }, + sidebar.contentWindow + ); + let popupshowingEvent = await popupshowing; + + Assert.equal( + popupshowingEvent.target.triggerNode?.id, + "search-box", + "Popupshowing event for the search input includes triggernode." + ); + + const popup = popupshowingEvent.target; + await BrowserTestUtils.waitForEvent(popup, "popupshown"); + + const popuphidden = BrowserTestUtils.waitForEvent(popup, "popuphidden"); + popup.hidePopup(); + await popuphidden; + + SidebarUI.toggle("viewBookmarksSidebar"); +}); |