Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / spatial-navigation / snav-input.html
blobd6eb46af4a2513669e24c1673b6444c221f47b33
1 <!DOCTYPE html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 <script src="resources/spatial-navigation-utils.js"></script>
5 </head>
6 <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
7 <p id="description"></p>
8 <table style="text-align: left; width: 100%; margin-left: auto; margin-right: auto;" border="1" cellpadding="2" cellspacing="1">
9 <tbody>
10 <tr>
11 <td style="vertical-align: top; text-align: center;"></td>
12 <td style="vertical-align: top; text-align: center;"><a id="2" href="a">2</a></td>
13 <td style="vertical-align: top; text-align: center;"></td>
14 </tr>
15 <tr>
16 <td style="vertical-align: top; text-align: center;"><a id="4" href="a">4</a></td>
17 <td style="vertical-align: top; text-align: center;"><input id="start" type="text" value="text"></td>
18 <td style="vertical-align: top; text-align: center;"><a id="6" href="a">6</a></td>
19 </tr>
20 <tr>
21 <td style="vertical-align: top; text-align: center;"></td>
22 <td style="vertical-align: top; text-align: center;"><a id="8" href="a">8</a></td>
23 <td style="vertical-align: top; text-align: center;"></td>
24 </tr>
25 </tbody>
26 </table>
27 <div id="console"></div>
28 <script type="application/javascript">
29 description('This test ensures the correctness of Spatial Navigation (SNav) algorithm over input box.<br>\
30 * Pre-conditions:<br>\
31 1) DRT support for SNav enable/disable.<br>\
32 * Navigation steps:<br>\
33 1) Loads this page, focus goes to "start" automatically.<br>\
34 2) Focus moves away from input box in 4 different directions to neighbor nodes and back.<br>');
36 var resultMap = [
37 ["Down", "start"],
38 ["Down", "8"],
39 ["Up", "start"],
40 ["Up", "start"],
41 ["Up", "2"],
42 ["Down", "start"],
43 ["Right", "start"],
44 ["Right", "6"],
45 ["Left", "start"],
46 ["Left", "start"],
47 ["Left", "4"],
48 ["Right", "start"],
49 ["DONE", "DONE"]
52 if (window.testRunner) {
53 testRunner.dumpAsText();
54 testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
55 window.internals.settings.setSpatialNavigationEnabled(true);
56 testRunner.waitUntilDone();
59 function runTest()
61 // starting the test itself: get to a known place.
62 document.getElementById("start").focus();
64 initTest(resultMap, testCompleted);
67 function testCompleted()
69 if (!window.testRunner)
70 return;
72 var text = 'A text containing a space';
73 for (var i = 0; i < text.length; ++i)
74 eventSender.keyDown(text.charAt(i));
75 shouldBeEqualToString("document.getElementById('start').value", text);
77 testRunner.notifyDone();
80 window.onload = runTest;
82 </script>
83 </body>
84 </html>