summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/bugs/test_bug265203.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/tests/mochitest/bugs/test_bug265203.html')
-rw-r--r--dom/tests/mochitest/bugs/test_bug265203.html108
1 files changed, 108 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 0000000000..94f56c0164
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug265203.html
@@ -0,0 +1,108 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=265203
+-->
+<head>
+ <title>Test for Bug 265203</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script 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("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ expectedResult = [ $("a1").firstChild, 7, $("a2") ]
+ nextTest = test2;
+ testFocus();
+}
+function test2() {
+ $("a3").focus();
+ expectedResult = [ $("a3"), 0, $("a3") ]
+ nextTest = test3;
+ testFocus();
+}
+function test3() {
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ synthesizeKey("KEY_ArrowRight");
+ expectedResult = [ $("a3").firstChild, 7, $("a3") ]
+ nextTest = SimpleTest.finish;
+ testFocus();
+}
+
+function startTest() {
+ if (gTestStarted)
+ return;
+ gTestStarted = true;
+ SpecialPowers.pushPrefEnv({"set": [["accessibility.browsewithcaret", true]]}, test0);
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(startTest);
+
+</script>
+</pre>
+</body>
+</html>