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