Git init
[framework/web/webkit-efl.git] / LayoutTests / fast / spatial-navigation / snav-single-select.html
1 <html>
2   <!--
3     This test ensures the correctness of Spatial Navigation (SNav) algorithm over single select element.
4
5     * Pre-conditions:
6     1) DRT support for SNav enable/disable.
7
8     * Navigation steps:
9     1) Loads this page, focus goes to "start" automatically.
10     2) Focus moves away from select in 4 different directions to neighbor nodes and back.
11   -->
12   <head>
13     <script src="../js/resources/js-test-pre.js"></script>
14     <script src="resources/spatial-navigation-utils.js"></script>
15     <script type="application/javascript">
16
17     var resultMap = [
18       ["Down", "8"],
19       ["Up", "start"],
20       ["Up", "2"],
21       ["Down", "start"],
22       ["Right", "6"],
23       ["Left", "start"],
24       ["Left", "4"],
25       ["Right", "start"],
26       ["Space", "start"],
27       ["Down", "start"],
28       ["Up", "start"],
29       ["Space", "start"],
30       ["Down", "8"],
31       ["DONE", "DONE"]
32     ];
33
34     if (window.layoutTestController) {
35       layoutTestController.dumpAsText();
36       layoutTestController.setSpatialNavigationEnabled(true);
37       layoutTestController.overridePreference("WebKitTabToLinksPreferenceKey", 1);
38       layoutTestController.waitUntilDone();
39     }
40
41     function runTest()
42     {
43       // starting the test itself: get to a known place.
44       document.getElementById("start").focus();
45
46       initTest(resultMap, additionalTest);
47     }
48
49     function additionalTest()
50     {
51       document.getElementById("start").focus();
52       shouldBe("gFocusedDocument.getElementById(\"start\").selectedIndex", "0");
53       eventSender.keyDown(" ");
54       eventSender.keyDown("downArrow");
55       shouldBe("gFocusedDocument.getElementById(\"start\").selectedIndex", "1");
56       eventSender.keyDown("upArrow");
57       shouldBe("gFocusedDocument.getElementById(\"start\").selectedIndex", "0");
58
59       testCompleted();
60     }
61
62     function testCompleted()
63     {
64       if (window.layoutTestController)
65         layoutTestController.notifyDone();
66     }
67
68     window.onload = runTest;
69
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     <table style="text-align: left; width: 100%; margin-left: auto; margin-right: auto;" border="1" cellpadding="2" cellspacing="1">
75       <tbody>
76         <tr>
77           <td style="vertical-align: top; text-align: center;"></td>
78           <td style="vertical-align: top; text-align: center;"><a id="2" href="a">2</a></td>
79           <td style="vertical-align: top; text-align: center;"></td>
80         </tr>
81         <tr>
82           <td style="vertical-align: top; text-align: center;"><a id="4" href="a">4</a></td>
83           <td style="vertical-align: top; text-align: center;"><select id="start"><option>1</option><option>2</option><option>3</option></select></td>
84           <td style="vertical-align: top; text-align: center;"><a id="6" href="a">6</a></td>
85         </tr>
86         <tr>
87           <td style="vertical-align: top; text-align: center;"></td>
88           <td style="vertical-align: top; text-align: center;"><a id="8" href="a">8</a></td>
89           <td style="vertical-align: top; text-align: center;"></td>
90         </tr>
91       </tbody>
92     </table>
93     <div id="console"></div>
94   </body>
95 </html>
96