1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
6 function getSelectInfo(myselect, mydiv) {
7 var s = document.getElementById(myselect);
8 var selectLength = s.length;
9 var optionCollectionLength = s.options.length;
10 var selectedInd = s.selectedIndex;
11 var opt = s.options[selectedInd];
15 optText = opt.innerHTML;
18 document.getElementById(mydiv).innerHTML = "Select length: " + selectLength + "<br>Option collection length: " + optionCollectionLength + "<br>Selected index: " + selectedInd + "<br>Selected option: " + optText;
21 function getAllInfo(x) {
22 for (i = 1; i < x; i++) {
33 <body onload="getAllInfo(12)">
34 <p><b>BUG ID:</b> <a href="rdar://problem/4229189">4229189</a> add a way to get a separator into a select element</p>
36 <p id="test" style="background-color:skyblue; padding:3px;"><b>STEPS TO TEST:</b>
37 Please describe the steps required to test this bug here.
41 These tests make sure that adding an hr element in a select works properly.
43 <p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>This should be a disabled popup menu, since the hr is not selectable.
45 <p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b> </p>
51 <p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>
52 You should see a popup menu with the following items: separator, option, separator
54 <p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>
58 <option>opt 1</option>
63 <p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>
64 You should see a popup menu with the following items: option, separator, option
66 <p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>
69 <option>opt 1</option>
71 <option>opt 2</option>
75 <p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>
76 You should see a popup menu with the following items: option, four separators, two options, separator, option.
78 <p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>
81 <option>opt 1</option>
86 <option>opt 2</option>
87 <option>opt 3</option>
89 <option>opt 4</option>
93 <p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>
94 You should see a popup menu with the following items: group label, option, separator (incl. in group).
96 <p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>
99 <optgroup label="Group 1">
100 <option>opt 1</option>
106 <p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>
107 You should see a popup menu with the following items: separator, group label, option.
109 <p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>
113 <optgroup label="Group 1">
114 <option>opt 1</option>
119 <p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>
120 You should see a popup menu with the following items: group label, option, separator, option, separator, option, two separators, (end of group), one option.
122 <p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>
125 <optgroup label="Group 1">
126 <option>opt 1</option>
128 <option>opt 2</option>
130 <option>opt 3</option>
134 <option>opt 4</option>
138 <p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>
139 You should see a popup menu with the following items: group label, one option two separators, (end of group), separator, group label, separator, two options, separator, (end of group), option.
142 <p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>
145 <optgroup label="Group 1">
146 <option>opt 1</option>
151 <optgroup label="Group 2">
153 <option>opt 2</option>
154 <option>opt 3</option>
157 <option>opt 4</option>
161 <p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>
162 A disabled popup menu - since the optgroup and the hr are not selectable.
164 <p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>
167 <optgroup label="Group 1">
173 <p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>
174 You should see a list box with the following items: 4 options.
176 <p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>
177 You should not see any separators in the list box.</p>
178 <br><select id = "s10" multiple>
179 <option value="test">opt 1</option>
184 <option>opt 2</option>
185 <option>opt 3</option>
187 <option>opt 4</option>
191 <p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>
192 You should see a list box with the following items: one option, group label, 3 options.
194 <p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>
195 You should not see any separators in the list box.</p>
196 <select id = "s11" multiple>
197 <option value="test">opt 1</option>
200 <optgroup label="Group 1">
203 <option>opt 2</option>
204 <option>opt 3</option>
206 <option>opt 4</option>
211 <p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b>
212 For each of these list boxes, when you change the selection in JavaScript to index 1, the second option should get highlighted</p>
213 <p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>
214 "opt 2" does not get highlighted after clicking the button.</p>
216 <select id="s12" multiple>
217 <option id="o3">opt 1</option>
219 <option id="o4">opt 2</option>
221 <input type="button" value="Change selection to 'opt 2'" onclick="document.getElementById('s12').selectedIndex = 1;"></input>
223 <br><select id="s13" multiple>
224 <option id="o5">opt 1</option>
226 <optgroup label="group">
227 <option id="o6">opt 2</option>
230 <input type="button" value="Change selection to 'opt 2'" onclick="document.getElementById('s13').selectedIndex = 1;"></input>