diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /layout/xul/test/browser_bug1163304.js | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/xul/test/browser_bug1163304.js')
-rw-r--r-- | layout/xul/test/browser_bug1163304.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/layout/xul/test/browser_bug1163304.js b/layout/xul/test/browser_bug1163304.js new file mode 100644 index 0000000000..149a56bd79 --- /dev/null +++ b/layout/xul/test/browser_bug1163304.js @@ -0,0 +1,56 @@ +ChromeUtils.import( + "resource://testing-common/CustomizableUITestUtils.jsm", + this +); +let gCUITestUtils = new CustomizableUITestUtils(window); + +add_task(async function test_setup() { + await gCUITestUtils.addSearchBar(); + registerCleanupFunction(() => { + gCUITestUtils.removeSearchBar(); + }); +}); + +add_task(async function() { + BrowserSearch.searchBar.focus(); + + let DOMWindowUtils = EventUtils._getDOMWindowUtils(); + is( + DOMWindowUtils.IMEStatus, + DOMWindowUtils.IME_STATUS_ENABLED, + "IME should be available when searchbar has focus" + ); + + let searchPopup = document.getElementById("PopupSearchAutoComplete"); + + let shownPromise = BrowserTestUtils.waitForEvent(searchPopup, "popupshown"); + // Open popup of the searchbar + EventUtils.synthesizeKey("KEY_F4"); + await shownPromise; + await new Promise(r => setTimeout(r, 0)); + + is( + DOMWindowUtils.IMEStatus, + DOMWindowUtils.IME_STATUS_ENABLED, + "IME should be available even when the popup of searchbar is open" + ); + + // Activate the menubar, then, the popup should be closed + let hiddenPromise = BrowserTestUtils.waitForEvent(searchPopup, "popuphidden"); + EventUtils.synthesizeKey("KEY_Alt"); + await hiddenPromise; + await new Promise(r => setTimeout(r, 0)); + + is( + DOMWindowUtils.IMEStatus, + DOMWindowUtils.IME_STATUS_DISABLED, + "IME should not be available when menubar is active" + ); + // Inactivate the menubar (and restore the focus to the searchbar + EventUtils.synthesizeKey("KEY_Escape"); + is( + DOMWindowUtils.IMEStatus, + DOMWindowUtils.IME_STATUS_ENABLED, + "IME should be available after focus is back to the searchbar" + ); +}); |