summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/spatial-navigation/snav-simple-content-overflow.html
blob: b3b126c1e1797619e1bc1a603e06f4377f58fd7b (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
<html>
  <!--
    This test ensures that overflowed content can be focused by Spatial Navigation.

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

    * Navigation steps:
    1) Loads this page, focus goes to "start" automatically.
    3) Try to traverse the links on page down.
       and then back up.

    * Expected results: After 'start' gets the focus, tapping down arrow should scroll its
      enclosing scrollable container (<div>) down, and *not* move focus to the link whose id is '2'.
  -->
  <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="../js/resources/js-test-pre.js"></script>
    <script src="resources/spatial-navigation-utils.js"></script>
    <script type="application/javascript">

    var resultMap = [
      ["Down", "start"],
      ["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">
    <div class="scroll">
      <p>It has a visible <a id="start" href="a">link_1</a>.</p>
      <br><br><br><br><br><br><br><br><br>
      <p>... and an overflowed link like <a id="1" href="a">this</a>.</p>
    </div>
    <br><br><br><br><br><br><br>
    <p>This link should NOT get <a id="start" href="a">focused</a>.</p>
    <div id="console"></div>
  </body>
</html>