Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / spatial-navigation / snav-textarea.html
blob07c4977973e1c8a5ee459853c77d83506f52f767
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;"><textarea id="start" rows="5" cols="2">abc d</textarea>
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 textarea.<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 textarea in 4 different directions to neighbor nodes and back.<br>');
36 var resultMap = [
37 ["Down", "start"],
38 ["Down", "start"],
39 ["Down", "8"],
40 ["Up", "start"],
41 ["Up", "2"],
42 ["Down", "start"],
43 ["Right", "start"],
44 ["Right", "start"],
45 ["Right", "start"],
46 ["Right", "start"],
47 ["Right", "start"],
48 ["Right", "6"],
49 ["Left", "start"],
50 ["Left", "4"],
51 ["Right", "start"],
52 ["DONE", "DONE"]
55 if (window.testRunner) {
56 testRunner.dumpAsText();
57 testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
58 window.internals.settings.setSpatialNavigationEnabled(true);
59 testRunner.waitUntilDone();
62 function runTest()
64 var textarea = document.getElementById("start");
65 textarea.value = "abc\nd";
67 // starting the test itself: get to a known place.
68 textarea.focus();
69 textarea.setSelectionRange(0, 0);
71 initTest(resultMap, testCompleted);
74 function testCompleted()
76 if (!window.testRunner)
77 return;
79 document.getElementById('start').value = "";
80 var text = 'A text containing a space\nand a new line';
81 for (var i = 0; i < text.length; ++i)
82 eventSender.keyDown(text.charAt(i));
83 shouldBeEqualToString("document.getElementById('start').value", text);
85 testRunner.notifyDone();
88 window.onload = runTest;
90 </script>
91 </body>
92 </html>