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