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 /widget/tests/test_ime_state_in_plugin_in_parent.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'widget/tests/test_ime_state_in_plugin_in_parent.html')
-rw-r--r-- | widget/tests/test_ime_state_in_plugin_in_parent.html | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/widget/tests/test_ime_state_in_plugin_in_parent.html b/widget/tests/test_ime_state_in_plugin_in_parent.html new file mode 100644 index 0000000000..9f3892ab88 --- /dev/null +++ b/widget/tests/test_ime_state_in_plugin_in_parent.html @@ -0,0 +1,92 @@ +<html> +<head> + <title>Test for IME state on plugin</title> + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <script src="file_ime_state_test_helper.js"></script> + <link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css"> +</head> +<body> +<input> +<object type="application/x-test"></object> +<script> +"use strict"; + +SimpleTest.waitForExplicitFinish(); +SimpleTest.waitForFocus(() => { + const tipWrapper = new TIPWrapper(window); + const plugin = document.querySelector("object"); + + // Plugins are not supported and their elements should not accept focus; + // therefore, IME should not enable when we play with it. + + document.activeElement?.blur(); + is( + window.windowUtils.IMEStatus, + Ci.nsIDOMWindowUtils.IME_STATUS_DISABLED, + "IME enabled state should be disabled when no element has focus" + ); + ok( + !tipWrapper.IMEHasFocus, + "IME should not have focus when no element has focus" + ); + + plugin.focus(); + is( + window.windowUtils.IMEStatus, + Ci.nsIDOMWindowUtils.IME_STATUS_DISABLED, + "IME enabled state should be disabled when an <object> for plugin has focus" + ); + ok( + !tipWrapper.IMEHasFocus, + "IME should not have focus when an <object> for plugin has focus" + ); + + plugin.blur(); + is( + window.windowUtils.IMEStatus, + Ci.nsIDOMWindowUtils.IME_STATUS_DISABLED, + "IME enabled state should be disabled when an <object> for plugin gets blurred" + ); + ok( + !tipWrapper.IMEHasFocus, + "IME should not have focus when an <object> for plugin gets blurred" + ); + + plugin.focus(); + is( + window.windowUtils.IMEStatus, + Ci.nsIDOMWindowUtils.IME_STATUS_DISABLED, + "IME enabled state should be disabled when an <object> for plugin gets focused again" + ); + ok( + !tipWrapper.IMEHasFocus, + "IME should not have focus when an <object> for plugin gets focused again" + ); + + plugin.remove(); + is( + window.windowUtils.IMEStatus, + Ci.nsIDOMWindowUtils.IME_STATUS_DISABLED, + "IME enabled state should be disabled when focused <object> for plugin is removed from the document" + ); + ok( + !tipWrapper.IMEHasFocus, + "IME should not have focus when focused <object> for plugin is removed from the document" + ); + + document.querySelector("input").focus(); + is( + window.windowUtils.IMEStatus, + Ci.nsIDOMWindowUtils.IME_STATUS_ENABLED, + "IME enabled state should be enabled after <input> gets focus" + ); + ok( + tipWrapper.IMEHasFocus, + "IME should have focus after <input> gets focus" + ); + + SimpleTest.finish(); +}); +</script> +</body> +</html> |