b17da6ca0991e6ece90218c7e4366d84d2d5252e
[WebKit-https.git] / LayoutTests / fast / spatial-navigation / snav-iframe-no-focusable-content.html
1 <html>
2   <!--
3     This test ensures the basic traversal correctness of Spatial Navigation
4     algorithm: iframes without any focusable content should be ignored.
5
6     * Pre-conditions:
7     1) DRT support for SNav 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 iframes
12        in between them, once both have no focusable elements inside.
13   -->
14   <head>
15     <script src="../js/resources/js-test-pre.js"></script>
16     <script src="resources/spatial-navigation-utils.js"></script>
17     <script type="application/javascript">
18
19     var resultMap = [
20       ["Down", "start"],
21       ["Down", "start"],
22       ["Down", "start"],
23       ["Down", "start"],
24       ["Down", "start"],
25       ["Down", "start"],
26       ["Down", "end"],
27       ["Up"  , "end"],
28       ["Up"  , "end"],
29       ["Up"  , "end"],
30       ["Up"  , "end"],
31       ["Up"  , "end"],
32       ["Up"  , "end"],
33       ["Up"  , "start"],
34       ["DONE", "DONE"]
35     ];
36
37     if (window.testRunner) {
38       testRunner.dumpAsText();
39       testRunner.setSpatialNavigationEnabled(true);
40       testRunner.overridePreference("WebKitTabToLinksPreferenceKey", 1);
41       testRunner.waitUntilDone();
42     }
43
44     function runTest()
45     {
46       // starting the test itself: get to a known place.
47       document.getElementById("start").focus();
48
49       initTest(resultMap, testCompleted);
50     }
51
52     function testCompleted()
53     {
54       if (window.testRunner)
55         testRunner.notifyDone();
56     }
57
58     window.onload = runTest;
59     </script>
60     <script src="js/resources/js-test-post.js"></script>
61   </head>
62   <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
63     <div><a id="start" href="a">a</a></div>
64
65     <iframe width="80" height="80" scrolling="auto" src="data:text/html,
66       <body>
67         <img width=120 height=200 src='resources/green.png'>
68       </body>
69     "></iframe><br>
70
71     <iframe scrolling="auto" src="data:text/html,
72       <body>
73         <img width=120 height=200 src='resources/green.png'>
74       </body>
75     "></iframe><br>
76
77     <a id="end" href="a">e</a>
78     <div id="console"></div>
79     This is to test that an iframe with no focusable content still scrolls
80   </body>
81 </html>