| 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/common.js"></script> | 5 <script src="../../forms/resources/common.js"></script> |
| 6 <script src="../../forms/resources/common-wheel-event.js"></script> | 6 <script src="../../forms/resources/common-wheel-event.js"></script> |
| 7 <script src="../../forms/resources/picker-common.js"></script> | 7 <script src="../../forms/resources/picker-common.js"></script> |
| 8 <script src="resources/suggestion-picker-common.js"></script> | 8 <script src="resources/suggestion-picker-common.js"></script> |
| 9 </head> | 9 </head> |
| 10 <body style="background-color: #bbbbbb;"> | 10 <body style="background-color: #bbbbbb;"> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 debug('Check that page popup doesn\'t exist at first.'); | 38 debug('Check that page popup doesn\'t exist at first.'); |
| 39 shouldBeNull('$("mock-page-popup")'); | 39 shouldBeNull('$("mock-page-popup")'); |
| 40 | 40 |
| 41 window.onload = function() { | 41 window.onload = function() { |
| 42 openPicker($('time'), test1); | 42 openPicker($('time'), test1); |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 | 45 |
| 46 function test1() { | 46 function test1() { |
| 47 debug('Check that page popup exists.'); | 47 debug('Check that page popup exists.'); |
| 48 shouldBe('popupWindow.pagePopupController.toString()', '"[object PagePopupCo
ntroller]"'); | 48 shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object
PagePopupController]'); |
| 49 | 49 |
| 50 debug('Check that page popup exists.'); | 50 debug('Check that page popup exists.'); |
| 51 shouldBe('popupWindow.pagePopupController.toString()', '"[object PagePopupCo
ntroller]"'); | 51 shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object
PagePopupController]'); |
| 52 | 52 |
| 53 debug('Check that hovering over an entry highlights it.'); | 53 debug('Check that hovering over an entry highlights it.'); |
| 54 hoverOverElement(popupWindow.document.querySelector(".suggestion-list-entry:
nth-child(2)")); | 54 hoverOverElement(popupWindow.document.querySelector(".suggestion-list-entry:
nth-child(2)")); |
| 55 shouldBe('highlightedEntry()', '"01:02"'); | 55 shouldBeEqualToString('highlightedEntry()', '01:02'); |
| 56 | 56 |
| 57 debug('Check that moving the mouse outside the popup de-highlights entries.'
); | 57 debug('Check that moving the mouse outside the popup de-highlights entries.'
); |
| 58 hoverOverElement(document.getElementById('description')); | 58 hoverOverElement(document.getElementById('description')); |
| 59 shouldBeNull('highlightedEntry()'); | 59 shouldBeNull('highlightedEntry()'); |
| 60 | 60 |
| 61 debug('Check that mouse click closes the popup and sets the value.'); | 61 debug('Check that mouse click closes the popup and sets the value.'); |
| 62 clickElement(popupWindow.document.querySelector(".suggestion-list-entry:nth-
child(3)")); | 62 clickElement(popupWindow.document.querySelector(".suggestion-list-entry:nth-
child(3)")); |
| 63 waitUntilClosing(test1AfterClosing); | 63 waitUntilClosing(test1AfterClosing); |
| 64 } | 64 } |
| 65 | 65 |
| 66 function test1AfterClosing() { | 66 function test1AfterClosing() { |
| 67 shouldBeNull('document.getElementById("mock-page-popup")'); | 67 shouldBeNull('document.getElementById("mock-page-popup")'); |
| 68 shouldBe('document.getElementById("time").value', '"01:03"'); | 68 shouldBeEqualToString('document.getElementById("time").value', '01:03'); |
| 69 | 69 |
| 70 openPicker($('time'), test2); | 70 openPicker($('time'), test2); |
| 71 } | 71 } |
| 72 | 72 |
| 73 var scrollTopBeforeWheelEvent = 0; | 73 var scrollTopBeforeWheelEvent = 0; |
| 74 var scrollTopAfterWheelEvent = 0; | 74 var scrollTopAfterWheelEvent = 0; |
| 75 | 75 |
| 76 function test2() { | 76 function test2() { |
| 77 var suggestionList = popupWindow.document.getElementsByClassName("suggestion
-list")[0]; | 77 var suggestionList = popupWindow.document.getElementsByClassName("suggestion
-list")[0]; |
| 78 | 78 |
| 79 debug('Check that you can scroll using the mouse wheel.'); | 79 debug('Check that you can scroll using the mouse wheel.'); |
| 80 | 80 |
| 81 scrollTopBeforeWheelEvent = suggestionList.scrollTop; | 81 scrollTopBeforeWheelEvent = suggestionList.scrollTop; |
| 82 dispatchWheelEvent(suggestionList, 0, -100); | 82 dispatchWheelEvent(suggestionList, 0, -100); |
| 83 scrollTopAfterWheelEvent = suggestionList.scrollTop; | 83 scrollTopAfterWheelEvent = suggestionList.scrollTop; |
| 84 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); | 84 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); |
| 85 | 85 |
| 86 scrollTopBeforeWheelEvent = suggestionList.scrollTop; | 86 scrollTopBeforeWheelEvent = suggestionList.scrollTop; |
| 87 dispatchWheelEvent(suggestionList, 0, 100); | 87 dispatchWheelEvent(suggestionList, 0, 100); |
| 88 scrollTopAfterWheelEvent = suggestionList.scrollTop; | 88 scrollTopAfterWheelEvent = suggestionList.scrollTop; |
| 89 shouldBeTrue('scrollTopBeforeWheelEvent > scrollTopAfterWheelEvent'); | 89 shouldBeTrue('scrollTopBeforeWheelEvent > scrollTopAfterWheelEvent'); |
| 90 | 90 |
| 91 popupWindow.focus(); | 91 popupWindow.focus(); |
| 92 eventSender.keyDown('\x1B'); | 92 eventSender.keyDown('escape'); |
| 93 waitUntilClosing(test2AfterClosing); | 93 waitUntilClosing(test2AfterClosing); |
| 94 } | 94 } |
| 95 | 95 |
| 96 function test2AfterClosing() { | 96 function test2AfterClosing() { |
| 97 shouldBeNull('$("mock-page-popup")'); | 97 shouldBeNull('$("mock-page-popup")'); |
| 98 | 98 |
| 99 openPicker($('time'), test3); | 99 openPicker($('time'), test3); |
| 100 } | 100 } |
| 101 | 101 |
| 102 function test3() { | 102 function test3() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 113 eventSender.mouseUp(); | 113 eventSender.mouseUp(); |
| 114 scrollTopAfterWheelEvent = suggestionList.scrollTop; | 114 scrollTopAfterWheelEvent = suggestionList.scrollTop; |
| 115 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); | 115 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); |
| 116 | 116 |
| 117 finishJSTest(); | 117 finishJSTest(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 </script> | 120 </script> |
| 121 </body> | 121 </body> |
| 122 </html> | 122 </html> |
| OLD | NEW |