Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / spatial-navigation / snav-single-select.html
blobddca34b91ae97b9ba5ed4f93ef0c7e66bbb06e92
1 <html>
2 <!--
3 This test ensures the correctness of Spatial Navigation (SNav) algorithm over single select element.
5 * Pre-conditions:
6 1) DRT support for SNav enable/disable.
8 * Navigation steps:
9 1) Loads this page, focus goes to "start" automatically.
10 2) Focus moves away from select in 4 different directions to neighbor nodes and back.
11 -->
12 <head>
13 <script src="../../resources/js-test.js"></script>
14 <script src="resources/spatial-navigation-utils.js"></script>
15 <script type="application/javascript">
17 var resultMap = [
18 ["Down", "8"],
19 ["Up", "start"],
20 ["Up", "2"],
21 ["Down", "start"],
22 ["Right", "6"],
23 ["Left", "start"],
24 ["Left", "4"],
25 ["Right", "start"],
26 ["Space", "start"],
27 ["Down", "start"],
28 ["Up", "start"],
29 ["Space", "start"],
30 ["Down", "8"],
31 ["DONE", "DONE"]
34 if (window.testRunner) {
35 testRunner.dumpAsText();
36 testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
37 window.internals.settings.setSpatialNavigationEnabled(true);
38 testRunner.waitUntilDone();
41 function runTest()
43 // starting the test itself: get to a known place.
44 document.getElementById("start").focus();
46 initTest(resultMap, additionalTest);
49 function additionalTest()
51 document.getElementById("start").focus();
52 shouldBe("gFocusedDocument.getElementById(\"start\").selectedIndex", "0");
53 eventSender.keyDown(" ");
54 eventSender.keyDown("downArrow");
55 shouldBe("gFocusedDocument.getElementById(\"start\").selectedIndex", "1");
56 eventSender.keyDown("upArrow");
57 shouldBe("gFocusedDocument.getElementById(\"start\").selectedIndex", "0");
59 testCompleted();
62 function testCompleted()
64 if (window.testRunner)
65 testRunner.notifyDone();
68 window.onload = runTest;
70 </script>
71 </head>
72 <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
73 <table style="text-align: left; width: 100%; margin-left: auto; margin-right: auto;" border="1" cellpadding="2" cellspacing="1">
74 <tbody>
75 <tr>
76 <td style="vertical-align: top; text-align: center;"></td>
77 <td style="vertical-align: top; text-align: center;"><a id="2" href="a">2</a></td>
78 <td style="vertical-align: top; text-align: center;"></td>
79 </tr>
80 <tr>
81 <td style="vertical-align: top; text-align: center;"><a id="4" href="a">4</a></td>
82 <td style="vertical-align: top; text-align: center;"><select id="start"><option>1</option><option>2</option><option>3</option></select></td>
83 <td style="vertical-align: top; text-align: center;"><a id="6" href="a">6</a></td>
84 </tr>
85 <tr>
86 <td style="vertical-align: top; text-align: center;"></td>
87 <td style="vertical-align: top; text-align: center;"><a id="8" href="a">8</a></td>
88 <td style="vertical-align: top; text-align: center;"></td>
89 </tr>
90 </tbody>
91 </table>
92 <div id="console"></div>
93 </body>
94 </html>