|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=563642 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 563642</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
|
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
11 </head> |
|
12 <body> |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=563642">Mozilla Bug 563642</a> |
|
14 <p id="display"> |
|
15 <select id="test1" multiple="multiple" size="1"> |
|
16 <option>Item 1</option> |
|
17 <option>Item 2</option> |
|
18 <option>Item 3</option> |
|
19 <option>Item 4</option> |
|
20 <option>Item 5</option> |
|
21 </select> |
|
22 <select id="test2" multiple="multiple" size="1"> |
|
23 <option>Item 1</option> |
|
24 <option disabled>Item 2</option> |
|
25 <option>Item 3</option> |
|
26 <option disabled>Item 4</option> |
|
27 <option>Item 5</option> |
|
28 </select> |
|
29 <select id="test3" multiple="multiple"></select> |
|
30 <select id="test4" multiple="multiple" size="1"></select> |
|
31 </p> |
|
32 <div id="content" style="display: none"> |
|
33 |
|
34 </div> |
|
35 <pre id="test"> |
|
36 <script type="application/javascript"> |
|
37 |
|
38 /** Test for Bug 563642 **/ |
|
39 |
|
40 // Turn off Spatial Navigation because it hijacks down and up key events. |
|
41 SpecialPowers.setBoolPref("snav.enabled", false); |
|
42 |
|
43 function pageUpDownTest(id,index) { |
|
44 var elm = document.getElementById(id); |
|
45 elm.focus(); |
|
46 elm.selectedIndex = 0; |
|
47 sendKey("page_down"); |
|
48 sendKey("page_down"); |
|
49 sendKey("page_down"); |
|
50 sendKey("page_up"); |
|
51 sendKey("page_down"); |
|
52 is(elm.selectedIndex, index, "pageUpDownTest: selectedIndex for " + id + " is " + index); |
|
53 } |
|
54 |
|
55 function upDownTest(id,index) { |
|
56 var elm = document.getElementById(id); |
|
57 elm.focus(); |
|
58 elm.selectedIndex = 0; |
|
59 sendKey("down"); |
|
60 sendKey("down"); |
|
61 sendKey("down"); |
|
62 sendKey("up"); |
|
63 sendKey("down"); |
|
64 is(elm.selectedIndex, index, "upDownTest: selectedIndex for " + id + " is " + index); |
|
65 } |
|
66 |
|
67 function runTest() { |
|
68 pageUpDownTest("test1",3); |
|
69 pageUpDownTest("test2",4); |
|
70 pageUpDownTest("test3",-1); |
|
71 pageUpDownTest("test4",-1); |
|
72 upDownTest("test1",3); |
|
73 upDownTest("test2",4); |
|
74 upDownTest("test3",-1); |
|
75 upDownTest("test4",-1); |
|
76 |
|
77 SimpleTest.finish(); |
|
78 } |
|
79 |
|
80 SimpleTest.waitForExplicitFinish(); |
|
81 SimpleTest.waitForFocus(runTest) |
|
82 |
|
83 </script> |
|
84 </pre> |
|
85 </body> |
|
86 </html> |