summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/spatial-navigation/snav-tiny-table-traversal.html
blob: 70ba0f5f7ee8b4014e6bc591ffbf1782110a5921 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<html>
  <!--
    This test ensures the basic table traversal correctness of
    Spatial Navigation (SNav) algorithm: focusable elements in a
    <table> should be accessible.

    * Pre-conditions:
    1) DRT support for SNav enable/disable.

    * Navigation steps:
    1) Loads this page, focus goes to "start" automatically.
    2) Focus moves along the elements in the table, eventually
       going to outer southward and eastward links, but going
       back inside the table later on.
  -->
  <head>
    <script src="../js/resources/js-test-pre.js"></script>
    <script src="resources/spatial-navigation-utils.js"></script>
    <script type="application/javascript">

    var resultMap = [
      ["Down", "1"],
      ["Down", "4"],
      ["Down", "7"],
      ["Down", "end"],
      ["Up", "7"],
      ["Right", "8"],
      ["Right", "9"],
      ["Up", "6"],
      ["Right", "right"],
      ["Left", "6"],
      ["Up", "3"],
      ["Left", "2"],
      ["Left", "1"],
      ["DONE", "DONE"]
    ];

    if (window.layoutTestController) {
      layoutTestController.dumpAsText();
      layoutTestController.setSpatialNavigationEnabled(true);
      layoutTestController.overridePreference("WebKitTabToLinksPreferenceKey", 1);
      layoutTestController.waitUntilDone();
    }

    function runTest()
    {
      // starting the test itself: get to a known place.
      document.getElementById("start").focus();

      initTest(resultMap, testCompleted);
    }

    function testCompleted()
    {
      if (window.layoutTestController)
        layoutTestController.notifyDone();
    }

    window.onload = runTest;

    </script>
    <script src="js/resources/js-test-post.js"></script>
  </head>
  <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
    <a id="start" href="a">a</a><br>
    <table>
      <tbody>
        <tr>
          <td style="font-size: small;"><a id="1" href="a">a</a></td>
          <td style="font-size: small;"><a id="2" href="a">a</a></td>
          <td style="font-size: small;"><a id="3" href="a">a</a></td>
        </tr>
        <tr>
          <td style="font-size: small;"><a id="4" href="a">a</a></td>
          <td style="font-size: small;"><a id="5" href="a">a</a></td>
          <td style="font-size: small;"><a id="6" href="a">a</a></td>
        </tr>
        <tr>
          <td style="font-size: small;"><a id="7" href="a">a</a></td>
          <td style="font-size: small;"><a id="8" href="a">a</a></td>
          <td style="font-size: small;"><a id="9" href="a">a</a></td>
        </tr>
      </tbody>
    </table>
    <div style='margin-top:8px'>
      <a id="end" href="a">a<a>
    </div>
    <div style="margin-left: 50px; margin-top:-70px">
      <a id="right" href="http://www.google.com">a</a>
    </div>
    <div style="margin-top:100px" id="console"></div>
  </body>
</html>