| 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/calendar-picker-common.js"></script> | 5 <script src="resources/calendar-picker-common.js"></script> |
| 6 </head> | 6 </head> |
| 7 <body> | 7 <body> |
| 8 <p id="description"></p> | 8 <p id="description"></p> |
| 9 <div id="console"></div> | 9 <div id="console"></div> |
| 10 <input type=week id=test> | 10 <input type=week id=test> |
| 11 <script> | 11 <script> |
| 12 description("Tests if pressing F4 opens the calendar picker."); | 12 description("Tests if pressing F4 opens the calendar picker."); |
| 13 | 13 |
| 14 debug('Check that page popup doesn\'t exist at first.'); | 14 debug('Check that page popup doesn\'t exist at first.'); |
| 15 shouldBeNull('internals.pagePopupWindow'); | 15 shouldBeNull('internals.pagePopupWindow'); |
| 16 | 16 |
| 17 debug('Press F4 key.'); | 17 debug('Press F4 key.'); |
| 18 sendKey(document.getElementById('test'), 'F4'); | 18 sendKey(document.getElementById('test'), 'F4'); |
| 19 shouldBeNonNull('internals.pagePopupWindow'); | 19 shouldBeNonNull('internals.pagePopupWindow'); |
| 20 | 20 |
| 21 function sendKey(input, keyName, ctrlKey, altKey) { | 21 function sendKey(input, keyName, ctrlKey, altKey) { |
| 22 var event = document.createEvent('KeyboardEvent'); | 22 var event = document.createEvent('KeyboardEvent'); |
| 23 event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName
, 0, ctrlKey, altKey); | 23 event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName
, 0, ctrlKey, altKey); |
| 24 input.focus(); |
| 24 input.dispatchEvent(event); | 25 input.dispatchEvent(event); |
| 25 } | 26 } |
| 26 </script> | 27 </script> |
| 27 </body> | 28 </body> |
| 28 </html> | 29 </html> |
| OLD | NEW |