| |
1 <!DOCTYPE HTML> |
| |
2 <html> |
| |
3 <!-- |
| |
4 https://bugzilla.mozilla.org/show_bug.cgi?id=698437 |
| |
5 --> |
| |
6 <head> |
| |
7 <meta charset="utf-8"> |
| |
8 <title>Test for Bug 698437</title> |
| |
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
| |
10 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
| |
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
| |
12 <script type="application/javascript"> |
| |
13 |
| |
14 /** Test for Bug 698437 **/ |
| |
15 |
| |
16 SimpleTest.waitForExplicitFinish(); |
| |
17 |
| |
18 function Test() { |
| |
19 if (!SpecialPowers.getBoolPref("snav.enabled")) { |
| |
20 todo(false, "Enable spatial navigiation on this platform."); |
| |
21 SimpleTest.finish(); |
| |
22 return; |
| |
23 } |
| |
24 |
| |
25 var center = document.getElementById("center"); |
| |
26 var right = document.getElementById("right"); |
| |
27 var left = document.getElementById("left"); |
| |
28 var top = document.getElementById("top"); |
| |
29 var bottom = document.getElementById("bottom"); |
| |
30 |
| |
31 console.log(top); |
| |
32 console.log(bottom); |
| |
33 console.log(center); |
| |
34 console.log(left); |
| |
35 console.log(right); |
| |
36 |
| |
37 center.focus(); |
| |
38 is(center.id, document.activeElement.id, "How did we call focus on center and it did" + |
| |
39 " not become the active element?"); |
| |
40 |
| |
41 synthesizeKey("VK_UP", { }); |
| |
42 is(top.id, document.activeElement.id, |
| |
43 "Spatial navigation up key is not handled correctly."); |
| |
44 |
| |
45 center.focus(); |
| |
46 synthesizeKey("VK_DOWN", { }); |
| |
47 is(bottom.id, document.activeElement.id, |
| |
48 "Spatial navigation down key is not handled correctly."); |
| |
49 |
| |
50 center.focus(); |
| |
51 synthesizeKey("VK_RIGHT", { }); |
| |
52 is(right.id, document.activeElement.id, |
| |
53 "Spatial navigation right key is not handled correctly."); |
| |
54 |
| |
55 center.focus(); |
| |
56 synthesizeKey("VK_LEFT", { }); |
| |
57 is(left.id, document.activeElement.id, |
| |
58 "Spatial navigation left key is not handled correctly."); |
| |
59 |
| |
60 SimpleTest.finish(); |
| |
61 } |
| |
62 |
| |
63 </script> |
| |
64 </head> |
| |
65 <body onload="Test();"> |
| |
66 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=698437">Mozilla Bug 698437</a> |
| |
67 <p id="display"></p> |
| |
68 <div id="content"> |
| |
69 <p> This is a <a id="top" href="#">really</a> long sentence </p> |
| |
70 <p> <a id="left" href="#">This</a> is a |
| |
71 <a id="center" href="#">really</a> long |
| |
72 <a id="right" href="#">sentence</a> </p> |
| |
73 <p> This is a <a id="bottom" href="#">really</a> long sentence </p> |
| |
74 </div> |
| |
75 <pre id="test"> |
| |
76 </pre> |
| |
77 </body> |
| |
78 </html> |