summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/spatial-navigation/snav-div-scrollable-but-without-focusable-content.html
blob: f33b686065f98b1ed77dc21fa5e168da7b1ffe75 (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
<html>
  <!--
    This test ensures the correctness of a basic aspect of spatial navigation traversal
    routines: scrollable block html elements without any focusable content should be ignored.

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

    * Navigation steps:
    1) Loads this page, focus goes to "start" automatically.
    2) Focus moves from "start" to "end" bypassing the two div's
       in between them, once both have no focusable elements inside.
  -->
  <head>
    <style type="text/css">
      div.scroll {
        height: 200px;
        width: 300px;
        overflow: auto;
        border: 1px solid #666;
        background-color: #ccc;
        padding: 8px;
      }
    </style>

    <script src="../../resources/js-test.js"></script>
    <script src="resources/spatial-navigation-utils.js"></script>
    <script type="application/javascript">

    var resultMap = [
      ["Down", "start"],
      ["Down", "start"],
      ["Down", "start"],
      ["Down", "start"],
      ["Down", "start"],
      ["Down", "start"],
      ["Down", "end"],
      ["Up"  , "end"],
      ["Up"  , "end"],
      ["Up"  , "end"],
      ["Up"  , "end"],
      ["Up"  , "end"],
      ["Up"  , "end"],
      ["Up"  , "start"],
      ["DONE", "DONE"]
    ];

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

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

      initTest(resultMap, testCompleted);
    }

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

    window.onload = runTest;
    </script>
  </head>
  <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
    <div><a id="start" href="a"><img src="resources/green.png" width=30 height=30></a></div>
    <div class="scroll">
      <img src="resources/green.png" width=240 height=300>
    </div>

    <div class="scroll">
      <img src="resources/green.png" width=240 height=300>
    </div>
    <div><a id="end" href="a"><img src="resources/green.png" width=30 height=30></a></div>
    <div id="console"></div>
    This test is to test that a scrollable div can scroll and reveal its content even if it does not have any focusable content.
  </body>
</html>