| 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="../../forms/resources/picker-common.js"></script> | 5 <script src="../../forms/resources/picker-common.js"></script> |
| 6 <script src="resources/suggestion-picker-common.js"></script> | 6 <script src="resources/suggestion-picker-common.js"></script> |
| 7 </head> | 7 </head> |
| 8 <body> | 8 <body> |
| 9 <script> | 9 <script> |
| 10 description('Checks reloading page resets input values'); | 10 description('Checks reloading page resets input values'); |
| 11 | 11 |
| 12 var iframe; | 12 var iframe; |
| 13 var testInput1; | 13 var testInput1; |
| 14 var testInput2; | 14 var testInput2; |
| 15 | 15 |
| 16 var iframeReloaded = false; | 16 var iframeReloaded = false; |
| 17 | 17 |
| 18 function runOnOpenPopup1() { | 18 function runOnOpenPopup1() { |
| 19 if (iframeReloaded) | 19 if (iframeReloaded) |
| 20 return; | 20 return; |
| 21 | 21 |
| 22 iframe = document.getElementById('iframe'); | 22 iframe = document.getElementById('iframe'); |
| 23 | 23 |
| 24 popupWindow.focus(); | 24 popupWindow.focus(); |
| 25 | 25 |
| 26 shouldBeNull('highlightedEntry()'); | 26 shouldBeNull('highlightedEntry()'); |
| 27 eventSender.keyDown('downArrow'); | 27 eventSender.keyDown('ArrowDown'); |
| 28 shouldBeEqualToString('highlightedEntry()', '2012-W01'); | 28 shouldBeEqualToString('highlightedEntry()', '2012-W01'); |
| 29 eventSender.keyDown('\n'); | 29 eventSender.keyDown('Enter'); |
| 30 waitUntilClosing(runOnOpenPopup1AfterClosing); | 30 waitUntilClosing(runOnOpenPopup1AfterClosing); |
| 31 } | 31 } |
| 32 | 32 |
| 33 function runOnOpenPopup1AfterClosing() { | 33 function runOnOpenPopup1AfterClosing() { |
| 34 shouldBeNull('document.getElementById("mock-page-popup")'); | 34 shouldBeNull('document.getElementById("mock-page-popup")'); |
| 35 shouldBeEqualToString('iframe.contentDocument.getElementById("test1").value'
, '2012-W01'); | 35 shouldBeEqualToString('iframe.contentDocument.getElementById("test1").value'
, '2012-W01'); |
| 36 | 36 |
| 37 openPicker(iframe.contentDocument.getElementById('test2'), runOnOpenPopup2); | 37 openPicker(iframe.contentDocument.getElementById('test2'), runOnOpenPopup2); |
| 38 } | 38 } |
| 39 | 39 |
| 40 function runOnOpenPopup2() { | 40 function runOnOpenPopup2() { |
| 41 popupWindow.focus(); | 41 popupWindow.focus(); |
| 42 | 42 |
| 43 shouldBeNull('highlightedEntry()'); | 43 shouldBeNull('highlightedEntry()'); |
| 44 eventSender.keyDown('downArrow'); | 44 eventSender.keyDown('ArrowDown'); |
| 45 shouldBeEqualToString('highlightedEntry()', '2012-W01'); | 45 shouldBeEqualToString('highlightedEntry()', '2012-W01'); |
| 46 eventSender.keyDown('\n'); | 46 eventSender.keyDown('Enter'); |
| 47 waitUntilClosing(runOnOpenPopup2AfterClosing); | 47 waitUntilClosing(runOnOpenPopup2AfterClosing); |
| 48 } | 48 } |
| 49 | 49 |
| 50 function runOnOpenPopup2AfterClosing() { | 50 function runOnOpenPopup2AfterClosing() { |
| 51 shouldBeNull('document.getElementById("mock-page-popup")'); | 51 shouldBeNull('document.getElementById("mock-page-popup")'); |
| 52 shouldBeEqualToString('iframe.contentDocument.getElementById("test2").value'
, '2012-W01'); | 52 shouldBeEqualToString('iframe.contentDocument.getElementById("test2").value'
, '2012-W01'); |
| 53 | 53 |
| 54 iframe.addEventListener('load', function () { parent.runOnIFrameLoad(); }); | 54 iframe.addEventListener('load', function () { parent.runOnIFrameLoad(); }); |
| 55 iframe.contentWindow.location.reload(); | 55 iframe.contentWindow.location.reload(); |
| 56 iframeReloaded = true; | 56 iframeReloaded = true; |
| 57 } | 57 } |
| 58 | 58 |
| 59 function runOnIFrameLoad() | 59 function runOnIFrameLoad() |
| 60 { | 60 { |
| 61 testInput1 = iframe.contentDocument.getElementById('test1'); | 61 testInput1 = iframe.contentDocument.getElementById('test1'); |
| 62 testInput2 = iframe.contentDocument.getElementById('test2'); | 62 testInput2 = iframe.contentDocument.getElementById('test2'); |
| 63 shouldBeEqualToString('testInput1.value', ''); | 63 shouldBeEqualToString('testInput1.value', ''); |
| 64 shouldBeEqualToString('testInput2.value', '2002-W02'); | 64 shouldBeEqualToString('testInput2.value', '2002-W02'); |
| 65 iframe.parentNode.removeChild(iframe); | 65 iframe.parentNode.removeChild(iframe); |
| 66 waitUntilClosing(finishJSTest); | 66 waitUntilClosing(finishJSTest); |
| 67 } | 67 } |
| 68 </script> | 68 </script> |
| 69 <iframe id=iframe onload="openPicker(event.target.contentDocument.getElementById
('test1'), runOnOpenPopup1);" srcdoc="<input type=week id=test1 list=suggestions
><input type=week id=test2 value=2002-W02 list=suggestions><datalist id=suggesti
ons><option>2012-W01</option></datalist>"></iframe> | 69 <iframe id=iframe onload="openPicker(event.target.contentDocument.getElementById
('test1'), runOnOpenPopup1);" srcdoc="<input type=week id=test1 list=suggestions
><input type=week id=test2 value=2002-W02 list=suggestions><datalist id=suggesti
ons><option>2012-W01</option></datalist>"></iframe> |
| 70 </body> | 70 </body> |
| 71 </html> | 71 </html> |
| OLD | NEW |