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 window.jsTestIsAsync = true; |
| 12 |
11 function test() | 13 function test() |
12 { | 14 { |
13 description('Test for opening select popup and closing.'); | 15 description('Test for opening select popup and closing.'); |
14 | 16 |
15 popup = document.getElementById('select'); | 17 popup = document.getElementById('select'); |
16 | 18 |
17 debug('These tests run specfically for Linux and Windows'); | 19 debug('These tests run specfically for Linux and Windows'); |
18 | 20 |
19 debug('Test opening and closing of popup using alt and down arrow key'); | 21 debug('Test opening and closing of popup using alt and down arrow key'); |
20 popup.focus(); | 22 popup.focus(); |
21 eventSender.keyDown('downArrow', ['altKey']); | 23 eventSender.keyDown('downArrow', ['altKey']); |
22 shouldBeTrue('internals.isSelectPopupVisible(popup)'); | 24 shouldBeTrue('internals.isSelectPopupVisible(popup)'); |
23 eventSender.keyDown('downArrow', ['altKey']); | 25 eventSender.keyDown('downArrow', ['altKey']); |
| 26 // We need this delay because in ListPicker._handleKeyDown we hide the |
| 27 // popup with a delay to avoid reopening the popup. |
| 28 setTimeout(test2, 0); |
| 29 } |
| 30 function test2() { |
24 shouldBeFalse('internals.isSelectPopupVisible(popup)'); | 31 shouldBeFalse('internals.isSelectPopupVisible(popup)'); |
25 | 32 |
26 debug('Test opening and closing of popup using alt and up arrow key'); | 33 debug('Test opening and closing of popup using alt and up arrow key'); |
27 popup.focus(); | 34 popup.focus(); |
28 eventSender.keyDown('upArrow', ['altKey']); | 35 eventSender.keyDown('upArrow', ['altKey']); |
29 shouldBeTrue('internals.isSelectPopupVisible(popup)'); | 36 shouldBeTrue('internals.isSelectPopupVisible(popup)'); |
30 eventSender.keyDown('upArrow', ['altKey']); | 37 eventSender.keyDown('upArrow', ['altKey']); |
| 38 // We need this delay because in ListPicker._handleKeyDown we hide the |
| 39 // popup with a delay to avoid reopening the popup. |
| 40 setTimeout(test3, 0); |
| 41 } |
| 42 function test3() { |
31 shouldBeFalse('internals.isSelectPopupVisible(popup)'); | 43 shouldBeFalse('internals.isSelectPopupVisible(popup)'); |
32 popup.blur(); | 44 popup.blur(); |
33 | 45 |
34 debug('Test opening of popup using F4'); | 46 debug('Test opening of popup using F4'); |
35 popup.focus(); | 47 popup.focus(); |
36 eventSender.keyDown('F4'); | 48 eventSender.keyDown('F4'); |
37 shouldBeTrue('internals.isSelectPopupVisible(popup)'); | 49 shouldBeTrue('internals.isSelectPopupVisible(popup)'); |
38 popup.blur(); | 50 popup.blur(); |
39 | 51 |
40 debug('Test opening of popup using enter key'); | 52 debug('Test opening of popup using enter key'); |
(...skipping 11 matching lines...) Expand all Loading... |
52 popup.blur(); | 64 popup.blur(); |
53 | 65 |
54 debug('Works for only mac'); | 66 debug('Works for only mac'); |
55 | 67 |
56 debug('Test opening of popup using up key'); | 68 debug('Test opening of popup using up key'); |
57 popup.focus(); | 69 popup.focus(); |
58 eventSender.keyDown('upArrow'); | 70 eventSender.keyDown('upArrow'); |
59 shouldBeTrue('internals.isSelectPopupVisible(popup)'); | 71 shouldBeTrue('internals.isSelectPopupVisible(popup)'); |
60 popup.blur(); | 72 popup.blur(); |
61 | 73 |
| 74 finishJSTest(); |
62 } | 75 } |
63 test(); | 76 test(); |
64 </script> | 77 </script> |
65 </body> | 78 </body> |
66 </html> | 79 </html> |
OLD | NEW |