summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/bugs/test_bug265203.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/tests/mochitest/bugs/test_bug265203.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/tests/mochitest/bugs/test_bug265203.html')
-rw-r--r--dom/tests/mochitest/bugs/test_bug265203.html110
1 files changed, 110 insertions, 0 deletions
diff --git a/dom/tests/mochitest/bugs/test_bug265203.html b/dom/tests/mochitest/bugs/test_bug265203.html
new file mode 100644
index 000000000..e5fe713f5
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug265203.html
@@ -0,0 +1,110 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=265203
+-->
+<head>
+ <title>Test for Bug 265203</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=265203">Mozilla Bug 265203</a>
+<p id="display">
+<a id="a1" href="http://www.mozilla.org">Mozilla</a><a id="a2"
+ href="http://www.mozilla.org/products/firefox">Firefox</a><br>
+<br>
+<table cellpadding="2" cellspacing="2" border="1"
+ style="text-align: left; width: 100%;">
+ <tbody>
+
+ <tr>
+ <td style="vertical-align: top;"><a id="a3" href="http://www.mozilla.org">Mozilla</a></td>
+ <td style="vertical-align: top;"><a
+ href="http://www.mozilla.org/products/firefox">Firefox</a></td>
+ </tr>
+ <tr>
+ <td style="vertical-align: top;"><a href="http://www.mozilla.org">Mozilla</a></td>
+ <td style="vertical-align: top;"><a
+ href="http://www.mozilla.org/products/firefox">Firefox</a></td>
+
+ </tr>
+ </tbody>
+</table>
+</p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 265203 **/
+var gTestStarted = false;
+var expectedResult = [ null, 0, null ];
+var nextTest;
+var test = 0;
+
+function testFocus() {
+ var selection = window.getSelection()
+ is(selection.focusNode, expectedResult[0],"test" + test + ": " + "caret node");
+ is(selection.focusOffset, expectedResult[1],"test" + test + ": " + "caret offset");
+ is(document.activeElement, expectedResult[2],"test" + test + ": " + "focused node");
+ ++test;
+ if (nextTest)
+ nextTest();
+}
+
+function test0() {
+ $("a1").focus();
+ expectedResult = [ $("a1"), 0, $("a1") ]
+ nextTest = test1;
+ testFocus();
+}
+function test1() {
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ expectedResult = [ $("a1").firstChild, 7, $("a2") ]
+ nextTest = test2;
+ testFocus();
+}
+function test2() {
+ $("a3").focus();
+ expectedResult = [ $("a3"), 0, $("a3") ]
+ nextTest = test3;
+ testFocus();
+}
+function test3() {
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ synthesizeKey("VK_RIGHT", { });
+ expectedResult = [ $("a3").firstChild, 7, $("a3") ]
+ nextTest = SimpleTest.finish;
+ testFocus();
+}
+
+function startTest() {
+ if (gTestStarted)
+ return;
+ gTestStarted = true;
+ // Turn off spatial navigation because it hijacks VK_RIGHT and VK_LEFT keydown
+ // events
+ SpecialPowers.pushPrefEnv({"set": [["accessibility.browsewithcaret", true], ["snav.enabled", false]]}, test0);
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(startTest);
+
+</script>
+</pre>
+</body>
+</html>