OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script> | 4 <script> |
| 5 window.jsTestIsAsync = true; |
5 window.enablePixelTesting = true; | 6 window.enablePixelTesting = true; |
6 </script> | 7 </script> |
7 <script src="../../../resources/js-test.js"></script> | 8 <script src="../../../resources/js-test.js"></script> |
8 <script src="../../forms/resources/picker-common.js"></script> | |
9 <script src="resources/calendar-picker-common.js"></script> | |
10 </head> | 9 </head> |
11 <body> | 10 <body> |
12 <input type=date id=date value="10000-12-31"> | 11 <input type=date id=date value="10000-12-31"> |
13 | |
14 <p id="description" style="opacity: 0"></p> | 12 <p id="description" style="opacity: 0"></p> |
15 <div id="console" style="opacity: 0"></div> | 13 <div id="console" style="opacity: 0"></div> |
| 14 <script> |
| 15 function sendKey(input, keyName, ctrlKey, altKey) { |
| 16 var event = document.createEvent('KeyboardEvent'); |
| 17 event.initKeyboardEvent('keydown', true, true, document.defaultView, keyName
, 0, ctrlKey, altKey); |
| 18 input.dispatchEvent(event); |
| 19 } |
16 | 20 |
17 <script> | 21 function openPicker(input, callback) { |
18 openPicker(document.getElementById('date'), finishJSTest); | 22 input.offsetTop; // Force layout. |
| 23 sendKey(input, "Down", false, true); |
| 24 callback.call(this); |
| 25 } |
| 26 |
| 27 function finishWhenOpen() { |
| 28 // We need to keep moving the window to the top left of available space |
| 29 // because the window will move back to (0, 0) when the |
| 30 // ShellViewMsg_SetTestConfiguration IPC arrives. |
| 31 window.moveTo(); |
| 32 // FIXME: resize event isn't firing in layout tests so we need to use a |
| 33 // timer to check if the popup is ready. |
| 34 if (window.internals.pagePopupWindow.innerWidth) |
| 35 finishJSTest(); |
| 36 else |
| 37 setTimeout(finishWhenOpen, 0); |
| 38 } |
| 39 |
| 40 // Move window to the top left of available space. |
| 41 window.moveTo(); |
| 42 openPicker(document.getElementById('date'), function () { |
| 43 finishWhenOpen(); |
| 44 }); |
| 45 |
19 </script> | 46 </script> |
20 </body> | 47 </body> |
21 </html> | 48 </html> |
OLD | NEW |