|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=365410 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 365410</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=365410">Mozilla Bug 365410</a> |
|
14 <p id="display"> |
|
15 <select id="test0" multiple="multiple"> |
|
16 <option id="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 <option>Item 6</option> |
|
22 <option>Item 7</option> |
|
23 <option>Item 8</option> |
|
24 <option>Item 9</option> |
|
25 <option>Item 10</option> |
|
26 <option>Item 11</option> |
|
27 <option>Item 12</option> |
|
28 <option>Item 13</option> |
|
29 <option>Item 14</option> |
|
30 <option>Item 15</option> |
|
31 </select> |
|
32 <select id="test1" multiple="multiple" size="1"> |
|
33 <option>Item 1</option> |
|
34 <option>Item 2</option> |
|
35 <option>Item 3</option> |
|
36 <option>Item 4</option> |
|
37 <option>Item 5</option> |
|
38 <option>Item 6</option> |
|
39 <option>Item 7</option> |
|
40 <option>Item 8</option> |
|
41 <option>Item 9</option> |
|
42 <option>Item 10</option> |
|
43 <option>Item 11</option> |
|
44 <option>Item 12</option> |
|
45 <option>Item 13</option> |
|
46 <option>Item 14</option> |
|
47 <option>Item 15</option> |
|
48 </select> |
|
49 <select id="test2" multiple="multiple" size="1" style="height:0.9em"> |
|
50 <option>Item 1</option> |
|
51 <option>Item 2</option> |
|
52 <option>Item 3</option> |
|
53 <option>Item 4</option> |
|
54 <option>Item 5</option> |
|
55 <option>Item 6</option> |
|
56 <option>Item 7</option> |
|
57 <option>Item 8</option> |
|
58 <option>Item 9</option> |
|
59 <option>Item 10</option> |
|
60 <option>Item 11</option> |
|
61 <option>Item 12</option> |
|
62 <option>Item 13</option> |
|
63 <option>Item 14</option> |
|
64 <option>Item 15</option> |
|
65 </select> |
|
66 <select id="test3" multiple="multiple" size="1"></select> |
|
67 <select id="test4" multiple="multiple" size="1" style="height:0.9em"></select> |
|
68 </p> |
|
69 <div id="content" style="display: none"> |
|
70 |
|
71 </div> |
|
72 <pre id="test"> |
|
73 <script type="application/javascript"> |
|
74 |
|
75 /** Test for Bug 365410 **/ |
|
76 |
|
77 // Turn off spatial nav so that it does not hijack the up and down events. |
|
78 SpecialPowers.setBoolPref("snav.enabled", false); |
|
79 |
|
80 function pageUpDownTest(id,index) { |
|
81 var elm = document.getElementById(id); |
|
82 elm.focus(); |
|
83 elm.selectedIndex = 0; |
|
84 sendKey("page_down"); |
|
85 sendKey("page_down"); |
|
86 sendKey("page_up"); |
|
87 sendKey("page_down"); |
|
88 is(elm.selectedIndex, index, "pageUpDownTest: selectedIndex for " + id + " is " + index); |
|
89 } |
|
90 |
|
91 function upDownTest(id,index) { |
|
92 var elm = document.getElementById(id); |
|
93 elm.focus(); |
|
94 elm.selectedIndex = 0; |
|
95 sendKey("down"); |
|
96 sendKey("down"); |
|
97 sendKey("up"); |
|
98 sendKey("down"); |
|
99 is(elm.selectedIndex, index, "upDownTest: selectedIndex for " + id + " is " + index); |
|
100 } |
|
101 |
|
102 function setHeight(id, h) { |
|
103 var elm = document.getElementById(id); |
|
104 elm.style.height = h + 'px'; |
|
105 } |
|
106 |
|
107 function runTest() { |
|
108 var h = document.getElementById("option").clientHeight; |
|
109 var list5itemsHeight = h * 5.5; |
|
110 setHeight("test0", list5itemsHeight); |
|
111 setHeight("test1", list5itemsHeight); |
|
112 setHeight("test3", list5itemsHeight); |
|
113 |
|
114 pageUpDownTest("test0",8); |
|
115 pageUpDownTest("test1",8); |
|
116 pageUpDownTest("test2",2); |
|
117 pageUpDownTest("test3",-1); |
|
118 pageUpDownTest("test4",-1); |
|
119 upDownTest("test0",2); |
|
120 upDownTest("test1",2); |
|
121 upDownTest("test2",2); |
|
122 upDownTest("test3",-1); |
|
123 upDownTest("test4",-1); |
|
124 |
|
125 SimpleTest.finish(); |
|
126 } |
|
127 |
|
128 SimpleTest.waitForExplicitFinish(); |
|
129 SimpleTest.waitForFocus(runTest) |
|
130 |
|
131 </script> |
|
132 </pre> |
|
133 </body> |
|
134 </html> |