5cb4365b35448e4e7c816c736aaf0744bb689559
[WebKit-https.git] / LayoutTests / fast / spatial-navigation / snav-div-scrollable-but-without-focusable-content.html
1 <html>
2   <!--
3     This test ensures the correctness of a basic aspect of spatial navigation traversal
4     routines: scrollable block html elements without any focusable content should be ignored.
5
6     * Pre-conditions:
7     1) DRT support for spatial navigation enable/disable.
8
9     * Navigation steps:
10     1) Loads this page, focus goes to "start" automatically.
11     2) Focus moves from "start" to "end" bypassing the two div's
12        in between them, once both have no focusable elements inside.
13   -->
14   <head>
15     <style type="text/css">
16       div.scroll {
17         height: 200px;
18         width: 300px;
19         overflow: auto;
20         border: 1px solid #666;
21         background-color: #ccc;
22         padding: 8px;
23       }
24     </style>
25
26     <script src="../js/resources/js-test-pre.js"></script>
27     <script src="resources/spatial-navigation-utils.js"></script>
28     <script type="application/javascript">
29
30     var resultMap = [
31       ["Down", "start"],
32       ["Down", "start"],
33       ["Down", "start"],
34       ["Down", "start"],
35       ["Down", "start"],
36       ["Down", "start"],
37       ["Down", "end"],
38       ["Up"  , "end"],
39       ["Up"  , "end"],
40       ["Up"  , "end"],
41       ["Up"  , "end"],
42       ["Up"  , "end"],
43       ["Up"  , "end"],
44       ["Up"  , "start"],
45       ["DONE", "DONE"]
46     ];
47
48     if (window.testRunner) {
49       testRunner.dumpAsText();
50       testRunner.setSpatialNavigationEnabled(true);
51       testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
52       testRunner.waitUntilDone();
53     }
54
55     function runTest()
56     {
57       // starting the test itself: get to a known place.
58       document.getElementById("start").focus();
59
60       initTest(resultMap, testCompleted);
61     }
62
63     function testCompleted()
64     {
65       if (window.testRunner)
66         testRunner.notifyDone();
67     }
68
69     window.onload = runTest;
70     </script>
71     <script src="js/resources/js-test-post.js"></script>
72   </head>
73   <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
74     <div><a id="start" href="a"><img src="resources/green.png" width=30 height=30></a></div>
75     <div class="scroll">
76       <img src="resources/green.png" width=240 height=300>
77     </div>
78
79     <div class="scroll">
80       <img src="resources/green.png" width=240 height=300>
81     </div>
82     <div><a id="end" href="a"><img src="resources/green.png" width=30 height=30></a></div>
83     <div id="console"></div>
84     This test is to test that a scrollable div can scroll and reveal its content even if it does not have any focusable content.
85   </body>
86 </html>