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 /accessible/tests/mochitest/textselection/test_userinput.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 'accessible/tests/mochitest/textselection/test_userinput.html')
-rw-r--r-- | accessible/tests/mochitest/textselection/test_userinput.html | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/accessible/tests/mochitest/textselection/test_userinput.html b/accessible/tests/mochitest/textselection/test_userinput.html new file mode 100644 index 0000000000..1aa0b2abb6 --- /dev/null +++ b/accessible/tests/mochitest/textselection/test_userinput.html @@ -0,0 +1,76 @@ +<html> + +<head> + <title>Text selection by user input</title> + + <link rel="stylesheet" type="text/css" + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + <script type="application/javascript" + src="../promisified-events.js"></script> + + <script type="application/javascript"> + async function doTests() { + // Tab to 't2' and then tab out of it: it must not have any selection. + info("Select all text in t1 and focus it"); + let focused = waitForEvent(EVENT_FOCUS, "t1"); + // Simulate tabbing to t1 by selecting all text before focusing it. + selectAllTextAndFocus("t1"); + await focused; + + info("Tab to t2"); + const t2 = getNode("t2"); + focused = waitForEvent(EVENT_FOCUS, t2); + synthesizeKey("VK_TAB"); + await focused; + + info("Tab to t3 and make sure there is no selection in t2 afterwards"); + const t3 = getNode("t3"); + focused = waitForEvent(EVENT_FOCUS, t3); + synthesizeKey("VK_TAB"); + await focused; + const prevFocus = getAccessible(t2, [ nsIAccessibleText ]); + is(prevFocus.selectionCount, 0, + "Wrong selection count for t2"); + + let exceptionCaught = false; + try { + const startOffsetObj = {}, endOffsetObj = {}; + prevFocus.getSelectionBounds(0, startOffsetObj, endOffsetObj); + } catch (e) { + exceptionCaught = true; + } + + ok(exceptionCaught, "No selection was expected for t2"); + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTests); + </script> +</head> + +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=440590" + title="Text selection information is not updated when HTML and XUL entries lose focus"> + Bug 440590 + </a> + <p id="display"></p> + <div id="content" style="display: none"></div> + <pre id="test"> + </pre> + + <input type="text" id="t1" maxlength="3" size="3" value="1"> + <input type="text" id="t2" maxlength="3" size="3" value="1"> + <input type="text" id="t3" maxlength="3" size="3" value="1"> + +</body> +</html> |