| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
| 5 <script src="../resources/common.js"></script> | 5 <script src="../resources/common.js"></script> |
| 6 <script src="../resources/picker-common.js"></script> | 6 <script src="../resources/picker-common.js"></script> |
| 7 </head> | 7 </head> |
| 8 <body> | 8 <body> |
| 9 <select id="menu"> | 9 <select id="menu"> |
| 10 <option>foo</option> | 10 <option>foo</option> |
| 11 <option selected>bar</option> | 11 <option selected>bar</option> |
| 12 <option hidden>baz</option> | 12 <option hidden>baz</option> |
| 13 <optgroup label="qux"> | 13 <optgroup label="qux"> |
| 14 <option>garply</option> | 14 <option>garply</option> |
| 15 </optgroup> | 15 </optgroup> |
| 16 </select> | 16 </select> |
| 17 <select id="menu2"> |
| 18 <option>abc</option> |
| 19 <option>xyz</option> |
| 20 </select> |
| 17 <div id="console"></div> | 21 <div id="console"></div> |
| 18 <script> | 22 <script> |
| 19 var menu = document.getElementById('menu'); | 23 var menu = document.getElementById('menu'); |
| 24 var menu2 = document.getElementById('menu2'); |
| 20 var picker = null; | 25 var picker = null; |
| 21 function openPickerErrorCallback() { | 26 function openPickerErrorCallback() { |
| 22 testFailed('picker didn\'t open') | 27 testFailed('picker didn\'t open') |
| 23 finishJSTest(); | 28 finishJSTest(); |
| 24 } | 29 } |
| 25 openPicker(menu, test1, openPickerErrorCallback); | 30 openPicker(menu, test1, openPickerErrorCallback); |
| 26 | 31 |
| 27 function test1() { | 32 function test1() { |
| 28 picker = window.internals.pagePopupWindow.global.picker; | 33 picker = window.internals.pagePopupWindow.global.picker; |
| 29 shouldBeEqualToString('picker._selectElement.value', '1'); | 34 shouldBeEqualToString('picker._selectElement.value', '1'); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 eventSender.keyDown('ArrowDown'); | 169 eventSender.keyDown('ArrowDown'); |
| 165 shouldBeEqualToString('picker._selectElement.value', '1'); | 170 shouldBeEqualToString('picker._selectElement.value', '1'); |
| 166 shouldBeEqualToString('menu.value', 'foo'); | 171 shouldBeEqualToString('menu.value', 'foo'); |
| 167 shouldBeEqualToString('internals.selectMenuListText(menu)', 'bar'); | 172 shouldBeEqualToString('internals.selectMenuListText(menu)', 'bar'); |
| 168 | 173 |
| 169 clickElement(picker._selectElement.children[0]); | 174 clickElement(picker._selectElement.children[0]); |
| 170 shouldBeNull('window.internals.pagePopupWindow'); | 175 shouldBeNull('window.internals.pagePopupWindow'); |
| 171 shouldBeEqualToString('menu.value', 'foo'); | 176 shouldBeEqualToString('menu.value', 'foo'); |
| 172 shouldBeEqualToString('internals.selectMenuListText(menu)', 'foo'); | 177 shouldBeEqualToString('internals.selectMenuListText(menu)', 'foo'); |
| 173 | 178 |
| 179 waitUntilClosing(() => { |
| 180 menu2.selectedIndex = -1; |
| 181 openPicker(menu2, testEnterWithoutSelection, openPickerErrorCallback); |
| 182 }); |
| 183 } |
| 184 |
| 185 function testEnterWithoutSelection() { |
| 186 picker = window.internals.pagePopupWindow.global.picker; |
| 187 shouldBeEqualToString('picker._selectElement.value', ''); |
| 188 eventSender.keyDown('Enter'); |
| 189 shouldBeNull('window.internals.pagePopupWindow'); |
| 190 shouldBeEqualToString('menu2.value', ''); |
| 191 |
| 174 finishJSTest(); | 192 finishJSTest(); |
| 175 } | 193 } |
| 176 </script> | 194 </script> |
| 177 </body> | 195 </body> |
| 178 </html> | 196 </html> |
| OLD | NEW |