OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../../resources/js-test.js"></script> | 3 <script src="../../../resources/js-test.js"></script> |
4 </head> | 4 </head> |
5 <body> | 5 <body> |
6 <select id="select"> | 6 <select id="select"> |
7 <option value="one">One</option> | 7 <option value="one">One</option> |
8 <option value="two">Two</option> | 8 <option value="two">Two</option> |
9 </select> | 9 </select> |
10 <script> | 10 <script> |
11 function test() | 11 function test() |
12 { | 12 { |
13 description('Test for opening select popup and closing.'); | 13 description('Test for opening select popup and closing.'); |
14 | 14 |
15 popup = document.getElementById('select'); | 15 popup = document.getElementById('select'); |
16 | 16 |
17 debug('These tests run specfically for Linux and Windows'); | 17 debug('These tests run specfically for Linux and Windows'); |
18 | 18 |
19 debug('Test opening and closing of popup using alt and down arrow key'); | 19 debug('Test opening and closing of popup using alt and down arrow key'); |
20 popup.focus(); | 20 popup.focus(); |
21 eventSender.keyDown('downArrow', ['altKey']); | 21 eventSender.keyDown('downArrow', ['altKey']); |
22 shouldBeTrue('internals.isSelectPopupVisible(popup)'); | 22 shouldBeTrue('internals.isSelectPopupVisible(popup)'); |
23 eventSender.keyDown('downArrow', ['altKey']); | 23 eventSender.keyDown('downArrow', ['altKey']); |
| 24 // FIXME: We need this delay because in ListPicker._handleKeyDown |
| 25 // we hide the popup with a delay to avoid reopening the popup. |
| 26 setTimeout(test2, 0); |
| 27 } |
| 28 function test2() { |
24 shouldBeFalse('internals.isSelectPopupVisible(popup)'); | 29 shouldBeFalse('internals.isSelectPopupVisible(popup)'); |
25 | 30 |
26 debug('Test opening and closing of popup using alt and up arrow key'); | 31 debug('Test opening and closing of popup using alt and up arrow key'); |
27 popup.focus(); | 32 popup.focus(); |
28 eventSender.keyDown('upArrow', ['altKey']); | 33 eventSender.keyDown('upArrow', ['altKey']); |
29 shouldBeTrue('internals.isSelectPopupVisible(popup)'); | 34 shouldBeTrue('internals.isSelectPopupVisible(popup)'); |
30 eventSender.keyDown('upArrow', ['altKey']); | 35 eventSender.keyDown('upArrow', ['altKey']); |
| 36 // FIXME: We need this delay because in ListPicker._handleKeyDown |
| 37 // we hide the popup with a delay to avoid reopening the popup. |
| 38 setTimeout(test3, 0); |
| 39 } |
| 40 function test3() { |
31 shouldBeFalse('internals.isSelectPopupVisible(popup)'); | 41 shouldBeFalse('internals.isSelectPopupVisible(popup)'); |
32 popup.blur(); | 42 popup.blur(); |
33 | 43 |
34 debug('Test opening of popup using F4'); | 44 debug('Test opening of popup using F4'); |
35 popup.focus(); | 45 popup.focus(); |
36 eventSender.keyDown('F4'); | 46 eventSender.keyDown('F4'); |
37 shouldBeTrue('internals.isSelectPopupVisible(popup)'); | 47 shouldBeTrue('internals.isSelectPopupVisible(popup)'); |
38 popup.blur(); | 48 popup.blur(); |
39 | 49 |
40 debug('Test opening of popup using enter key'); | 50 debug('Test opening of popup using enter key'); |
(...skipping 16 matching lines...) Expand all Loading... |
57 popup.focus(); | 67 popup.focus(); |
58 eventSender.keyDown('upArrow'); | 68 eventSender.keyDown('upArrow'); |
59 shouldBeTrue('internals.isSelectPopupVisible(popup)'); | 69 shouldBeTrue('internals.isSelectPopupVisible(popup)'); |
60 popup.blur(); | 70 popup.blur(); |
61 | 71 |
62 } | 72 } |
63 test(); | 73 test(); |
64 </script> | 74 </script> |
65 </body> | 75 </body> |
66 </html> | 76 </html> |
OLD | NEW |