Merge mozilla-central to autoland. CLOSED TREE
[gecko.git] / widget / tests / test_ime_state_in_plugin_in_parent.html
blob9f3892ab8861c96737dd4a293f7301b807893125
1 <html>
2 <head>
3 <title>Test for IME state on plugin</title>
4 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
5 <script src="file_ime_state_test_helper.js"></script>
6 <link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css">
7 </head>
8 <body>
9 <input>
10 <object type="application/x-test"></object>
11 <script>
12 "use strict";
14 SimpleTest.waitForExplicitFinish();
15 SimpleTest.waitForFocus(() => {
16 const tipWrapper = new TIPWrapper(window);
17 const plugin = document.querySelector("object");
19 // Plugins are not supported and their elements should not accept focus;
20 // therefore, IME should not enable when we play with it.
22 document.activeElement?.blur();
23 is(
24 window.windowUtils.IMEStatus,
25 Ci.nsIDOMWindowUtils.IME_STATUS_DISABLED,
26 "IME enabled state should be disabled when no element has focus"
28 ok(
29 !tipWrapper.IMEHasFocus,
30 "IME should not have focus when no element has focus"
33 plugin.focus();
34 is(
35 window.windowUtils.IMEStatus,
36 Ci.nsIDOMWindowUtils.IME_STATUS_DISABLED,
37 "IME enabled state should be disabled when an <object> for plugin has focus"
39 ok(
40 !tipWrapper.IMEHasFocus,
41 "IME should not have focus when an <object> for plugin has focus"
44 plugin.blur();
45 is(
46 window.windowUtils.IMEStatus,
47 Ci.nsIDOMWindowUtils.IME_STATUS_DISABLED,
48 "IME enabled state should be disabled when an <object> for plugin gets blurred"
50 ok(
51 !tipWrapper.IMEHasFocus,
52 "IME should not have focus when an <object> for plugin gets blurred"
55 plugin.focus();
56 is(
57 window.windowUtils.IMEStatus,
58 Ci.nsIDOMWindowUtils.IME_STATUS_DISABLED,
59 "IME enabled state should be disabled when an <object> for plugin gets focused again"
61 ok(
62 !tipWrapper.IMEHasFocus,
63 "IME should not have focus when an <object> for plugin gets focused again"
66 plugin.remove();
67 is(
68 window.windowUtils.IMEStatus,
69 Ci.nsIDOMWindowUtils.IME_STATUS_DISABLED,
70 "IME enabled state should be disabled when focused <object> for plugin is removed from the document"
72 ok(
73 !tipWrapper.IMEHasFocus,
74 "IME should not have focus when focused <object> for plugin is removed from the document"
77 document.querySelector("input").focus();
78 is(
79 window.windowUtils.IMEStatus,
80 Ci.nsIDOMWindowUtils.IME_STATUS_ENABLED,
81 "IME enabled state should be enabled after <input> gets focus"
83 ok(
84 tipWrapper.IMEHasFocus,
85 "IME should have focus after <input> gets focus"
88 SimpleTest.finish();
89 });
90 </script>
91 </body>
92 </html>