OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <head> | 2 <head> |
3 <script src="../../resources/js-test.js"></script> | 3 <script src="../../resources/js-test.js"></script> |
4 <script src="resources/spatial-navigation-utils.js"></script> | 4 <script src="resources/spatial-navigation-utils.js"></script> |
5 </head> | 5 </head> |
6 <style> | 6 <style> |
7 body a { | 7 body a { |
8 position: absolute; | 8 position: absolute; |
9 height: 100px; | 9 height: 40px; |
10 width: 100px; | 10 width: 80px; |
11 border: 1px solid black; | 11 border: 1px solid black; |
12 } | 12 } |
13 #e1 { | 13 #e1 { |
14 left: 10px; | 14 left: calc(100px - 100px / 2); |
15 top: 10px; | 15 top: calc(150px - 100px / 2); |
16 } | 16 } |
17 #e2 { | 17 #e2 { |
18 left: 20px; | 18 left: calc(400px - 100px / 2); |
19 top: 75px; | 19 top: calc(150px - 100px / 2); |
20 } | 20 } |
21 #e3 { | 21 #e3 { |
22 left: 10px; | 22 left: calc((400px + 100px) / 2 - 100px / 2); |
23 top: 150px; | 23 top: calc((450px + 150px) / 2 - 100px / 2); |
24 } | 24 } |
25 #e4 { | 25 #e4 { |
26 left: 10px; | 26 left: calc(100px - 100px / 2); |
27 top: 300px; | 27 top: calc(450px - 100px / 2); |
28 } | 28 } |
29 #e5 { | 29 #e5 { |
30 left: 75px; | 30 left: calc(400px - 100px / 2); |
31 top: 300px; | 31 top: calc(450px - 100px / 2); |
32 } | |
33 #e6 { | |
34 left: 150px; | |
35 top: 300px; | |
36 } | 32 } |
37 </style> | 33 </style> |
38 <body id="some-content" onload="runTest()"> | 34 <body id="some-content" onload="runTest()"> |
39 <p id="description"></p> | 35 <p id="description"></p> |
40 <div id="elements"> | 36 <div id="elements"> |
41 <!-- Vertical: --> | 37 <a id="e1" href="#e1">E1</a> |
42 <a id="e1" href="#e1">Element 1</a> | 38 <a id="e2" href="#e2">E2</a> |
43 <a id="e2" href="#e2">Element 2</a> | 39 <a id="e3" href="#e3">E3</a> |
44 <a id="e3" href="#e3">Element 3</a> | 40 <a id="e4" href="#e4">E4</a> |
45 <!-- Horizontal: --> | 41 <a id="e5" href="#e5">E5</a> |
46 <a id="e4" href="#e1">Element 4</a> | |
47 <a id="e5" href="#e2">Element 5</a> | |
48 <a id="e6" href="#e3">Element 6</a> | |
49 </div> | 42 </div> |
50 <div id="console"></div> | 43 <div id="console"></div> |
51 <script type="application/javascript"> | 44 <script type="application/javascript"> |
52 description('This test ensures that Spatial Navigation works with overlapping el
ements'); | 45 description('This test ensures that Spatial Navigation works with symmetrically
positoned rects'); |
53 | 46 |
54 jsTestIsAsync = true; | 47 jsTestIsAsync = true; |
55 | 48 |
56 var resultMap = [ | 49 var resultMap = [ |
57 // Vertical: | |
58 ["Down", "e2"], | |
59 ["Down", "e3"], | |
60 ["Up", "e2"], | |
61 ["Up", "e1"], | |
62 ["Down", "e2"], | |
63 ["Down", "e3"], | 50 ["Down", "e3"], |
64 ["Down", "e4"], | 51 ["Down", "e4"], |
65 // Horizontal: | 52 ["Up", "e3"], |
| 53 ["Up", "e1"], |
| 54 ["Right", "e2"], |
| 55 ["Down", "e3"], |
| 56 ["Down", "e4"], |
66 ["Right", "e5"], | 57 ["Right", "e5"], |
67 ["Right", "e6"], | |
68 ["Left", "e5"], | |
69 ["Left", "e4"], | |
70 ["DONE", "DONE"] | 58 ["DONE", "DONE"] |
71 ]; | 59 ]; |
72 | 60 |
73 if (window.testRunner) { | 61 if (window.testRunner) { |
74 testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1); | 62 testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1); |
75 window.internals.settings.setSpatialNavigationEnabled(true); | 63 window.internals.settings.setSpatialNavigationEnabled(true); |
76 } | 64 } |
77 | 65 |
78 function runTest() | 66 function runTest() |
79 { | 67 { |
80 // starting the test itself: get to a known place. | 68 // starting the test itself: get to a known place. |
81 document.getElementById("e1").focus(); | 69 document.getElementById("e1").focus(); |
82 | 70 |
83 initTest(resultMap, finishJSTest); | 71 initTest(resultMap, finishJSTest); |
84 } | 72 } |
85 </script> | 73 </script> |
86 </body> | 74 </body> |
87 </html> | 75 </html> |
OLD | NEW |