3 This test ensures the correctness of Spatial Navigation (SNav) algorithm over multiple select element.
6 1) DRT support for SNav enable/disable.
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.
13 <script src=
"../../resources/js-test.js"></script>
14 <script src=
"resources/spatial-navigation-utils.js"></script>
15 <script type=
"application/javascript">
34 if (window.testRunner) {
35 testRunner.dumpAsText();
36 testRunner.overridePreference(
"WebKitTabToLinksPreferenceKey",
1);
37 window.internals.settings.setSpatialNavigationEnabled(true);
38 testRunner.waitUntilDone();
43 // starting the test itself: get to a known place.
44 document.getElementById(
"start").focus();
46 initTest(resultMap, additionalTest);
49 function additionalTest()
51 document.getElementById(
"start").focus(); //move to
1st item
52 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[0].selected",
"false");
53 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[1].selected",
"false");
54 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[2].selected",
"false");
55 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[3].selected",
"false");
56 eventSender.keyDown(
"downArrow"); //move to
2nd item
57 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[0].selected",
"false");
58 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[1].selected",
"false");
59 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[2].selected",
"false");
60 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[3].selected",
"false");
61 eventSender.keyDown(
" "); //select
2nd item
62 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[0].selected",
"false");
63 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[1].selected",
"true");
64 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[2].selected",
"false");
65 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[3].selected",
"false");
66 eventSender.keyDown(
"downArrow"); //move to
4th item (
3rd item is disabled)
67 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[0].selected",
"false");
68 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[1].selected",
"true");
69 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[2].selected",
"false");
70 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[3].selected",
"false");
71 eventSender.keyDown(
" "); //select
4th item
72 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[0].selected",
"false");
73 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[1].selected",
"true");
74 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[2].selected",
"false");
75 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[3].selected",
"true");
76 eventSender.keyDown(
"upArrow"); //move back to
2nd item
77 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[0].selected",
"false");
78 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[1].selected",
"true");
79 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[2].selected",
"false");
80 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[3].selected",
"true");
81 eventSender.keyDown(
" "); //deselect
2nd item
82 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[0].selected",
"false");
83 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[1].selected",
"false");
84 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[2].selected",
"false");
85 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[3].selected",
"true");
86 eventSender.keyDown(
"upArrow"); //move back to
1st item
87 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[0].selected",
"false");
88 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[1].selected",
"false");
89 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[2].selected",
"false");
90 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[3].selected",
"true");
91 eventSender.keyDown(
"downArrow", [
"shiftKey"]); //shift-down to
2nd item
92 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[0].selected",
"false");
93 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[1].selected",
"true");
94 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[2].selected",
"false");
95 shouldBe(
"gFocusedDocument.getElementById(\"start\
").options[3].selected",
"true");
100 function testCompleted()
102 if (window.testRunner)
103 testRunner.notifyDone();
106 window.onload = runTest;
110 <body id=
"some-content" xmlns=
"http://www.w3.org/1999/xhtml">
111 <table style=
"text-align: left; width: 100%; margin-left: auto; margin-right: auto;" border=
"1" cellpadding=
"2" cellspacing=
"1">
114 <td style=
"vertical-align: top; text-align: center;"></td>
115 <td style=
"vertical-align: top; text-align: center;"><a id=
"2" href=
"a">2</a></td>
116 <td style=
"vertical-align: top; text-align: center;"></td>
119 <td style=
"vertical-align: top; text-align: center;"><a id=
"4" href=
"a">4</a></td>
120 <td style=
"vertical-align: top; text-align: center;"><select id=
"start" multiple
><option>1</option><option>2</option><option disabled
>3</option><option>4</option></select></td>
121 <td style=
"vertical-align: top; text-align: center;"><a id=
"6" href=
"a">6</a></td>
124 <td style=
"vertical-align: top; text-align: center;"></td>
125 <td style=
"vertical-align: top; text-align: center;"><a id=
"8" href=
"a">8</a></td>
126 <td style=
"vertical-align: top; text-align: center;"></td>
130 <div id=
"console"></div>