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_on_focus_move_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_on_focus_move_in_parent.html')
-rw-r--r-- | widget/tests/test_ime_state_on_focus_move_in_parent.html | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/widget/tests/test_ime_state_on_focus_move_in_parent.html b/widget/tests/test_ime_state_on_focus_move_in_parent.html new file mode 100644 index 0000000000..fd74d61c7e --- /dev/null +++ b/widget/tests/test_ime_state_on_focus_move_in_parent.html @@ -0,0 +1,88 @@ +<!doctype html> +<html style="ime-mode: disabled;"> +<head> + <meta charset="utf-8"> + <title>Test for IME state management on focus move in parent process</title> + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> + <script src="file_ime_state_test_helper.js"></script> + <script src="file_test_ime_state_on_focus_move.js"></script> + <link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css"> +</head> +<body style="ime-mode: disabled;"> +<div style="ime-mode: disabled;"></div> +<script> +"use strict"; + +/* import-globals-from file_ime_state_test_helper.js */ +/* import-globals-from file_test_ime_state_on_focus_move.js */ + +SimpleTest.waitForExplicitFinish(); +SimpleTest.waitForFocus(async () => { + const tipWrapper = new TIPWrapper(window); + ok(tipWrapper.isAvailable(), "TextInputProcessor should've been initialized"); + + const container = document.querySelector("div"); + async function runIMEStateOnFocusMoveTests(aDescription) { + { + const runnerAndChecker = new IMEStateWhenNoActiveElementTester(aDescription); + const expectedData = await runnerAndChecker.run(document); + runnerAndChecker.check(expectedData); + } + for (let index = 0; index < IMEStateOnFocusMoveTester.numberOfTests; ++index) { + const runnerAndChecker = new IMEStateOnFocusMoveTester(aDescription, index); + const expectedData = await runnerAndChecker.prepareToRun(container); + runnerAndChecker.prepareToCheck(expectedData, tipWrapper); + await runnerAndChecker.run(); + runnerAndChecker.check(expectedData); + if (runnerAndChecker.canTestOpenCloseState(expectedData)) { + for (const defaultOpenState of [false, true]) { + const expectedOpenStateData = + await runnerAndChecker.prepareToRunOpenCloseTest(container); + runnerAndChecker.prepareToCheckOpenCloseTest( + defaultOpenState, + expectedOpenStateData + ); + await runnerAndChecker.runOpenCloseTest(); + runnerAndChecker.checkOpenCloseTest(expectedOpenStateData); + } + } + runnerAndChecker.destroy(); + } + } + + // test for normal contents. + await runIMEStateOnFocusMoveTests("in non-editable container"); + + // test for contentEditable="true" + container.setAttribute("contenteditable", "true"); + await runIMEStateOnFocusMoveTests("in div[contenteditable]"); + + // test for contentEditable="false" + container.setAttribute("contenteditable", "false"); + await runIMEStateOnFocusMoveTests('in div[contenteditable="false"]'); + + // test for removing contentEditable + container.setAttribute("contenteditable", "true"); + container.focus(); + await new Promise(resolve => + requestAnimationFrame( + () => requestAnimationFrame(resolve) + ) + ); + container.removeAttribute("contenteditable"); + await runIMEStateOnFocusMoveTests("after removing contenteditable from the container"); + + // test designMode + document.designMode = "on"; + await runIMEStateOnFocusMoveTests('in designMode="on"'); + document.designMode = "off"; + await runIMEStateOnFocusMoveTests('in designMode="off"'); + + tipWrapper.destroy(); + + SimpleTest.finish(); +}); +</script> +</body> +</html> |