1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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"
);
});
|