Chromium Code Reviews| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 <option>2012-03-03</option> | 77 <option>2012-03-03</option> |
| 78 <option>2012-03-04</option> | 78 <option>2012-03-04</option> |
| 79 <option>2012-03-05</option> | 79 <option>2012-03-05</option> |
| 80 <option>2012-03-06</option> | 80 <option>2012-03-06</option> |
| 81 <option>2012-03-07</option> | 81 <option>2012-03-07</option> |
| 82 <option>2012-03-08</option> | 82 <option>2012-03-08</option> |
| 83 <option>2012-01-00</option> <!--invalid--> | 83 <option>2012-01-00</option> <!--invalid--> |
| 84 <option>foo</option> <!--invalid--> | 84 <option>foo</option> <!--invalid--> |
| 85 </datalist> | 85 </datalist> |
| 86 <script> | 86 <script> |
| 87 | |
| 87 debug('Check that page popup doesn\'t exist at first.'); | 88 debug('Check that page popup doesn\'t exist at first.'); |
| 88 shouldBeNull('$("mock-page-popup")'); | 89 shouldBeNull('$("mock-page-popup")'); |
| 89 | 90 |
| 90 openPicker($('date'), test1); | 91 openPicker($('date'), test1); |
| 91 | 92 |
| 92 function test1() { | 93 function test1() { |
| 93 debug('Check that page popup exists.'); | 94 debug('Check that page popup exists.'); |
| 94 shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object PagePopupController]'); | 95 shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object PagePopupController]'); |
| 95 | 96 |
| 96 debug('Check that hovering over an entry highlights it.'); | 97 debug('Check that hovering over an entry highlights it.'); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 108 | 109 |
| 109 function test1AfterClosing() { | 110 function test1AfterClosing() { |
| 110 shouldBeNull('$("mock-page-popup")'); | 111 shouldBeNull('$("mock-page-popup")'); |
| 111 shouldBeEqualToString('document.getElementById("date").value', '2012-01-03') ; | 112 shouldBeEqualToString('document.getElementById("date").value', '2012-01-03') ; |
| 112 | 113 |
| 113 openPicker($('date'), test2); | 114 openPicker($('date'), test2); |
| 114 } | 115 } |
| 115 | 116 |
| 116 var scrollTopBeforeWheelEvent = 0; | 117 var scrollTopBeforeWheelEvent = 0; |
| 117 var scrollTopAfterWheelEvent = 0; | 118 var scrollTopAfterWheelEvent = 0; |
| 119 var suggestionList; | |
| 118 | 120 |
| 119 function test2() { | 121 function test2() { |
| 120 var suggestionList = popupWindow.document.getElementsByClassName("suggestion -list")[0]; | 122 suggestionList = popupWindow.document.getElementsByClassName("suggestion-lis t")[0]; |
| 121 | 123 |
| 122 debug('Check that you can scroll using the mouse wheel.'); | 124 debug('Check that you can scroll using the mouse wheel.'); |
| 123 | 125 |
| 124 scrollTopBeforeWheelEvent = suggestionList.scrollTop; | 126 function finishTest() { |
| 125 dispatchWheelEvent(suggestionList, 0, -100); | 127 popupWindow.focus(); |
| 126 scrollTopAfterWheelEvent = suggestionList.scrollTop; | 128 eventSender.keyDown('escape'); |
| 127 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); | 129 waitUntilClosing(test2AfterClosing); |
| 130 } | |
| 128 | 131 |
| 129 scrollTopBeforeWheelEvent = suggestionList.scrollTop; | 132 function scrollUp() { |
| 130 dispatchWheelEvent(suggestionList, 0, 100); | 133 scrollTopBeforeWheelEvent = suggestionList.scrollTop; |
| 131 scrollTopAfterWheelEvent = suggestionList.scrollTop; | 134 dispatchWheelEvent(suggestionList, 0, 100); |
| 132 shouldBeTrue('scrollTopBeforeWheelEvent > scrollTopAfterWheelEvent'); | 135 shouldBecomeEqual('scrollTopBeforeWheelEvent > suggestionList.scrollTop' , 'true', finishTest) |
|
skobes
2015/11/06 22:30:23
missing ;
ymalik
2015/11/07 04:22:27
Done.
| |
| 136 } | |
| 133 | 137 |
| 134 popupWindow.focus(); | 138 function scrollDown() { |
| 135 eventSender.keyDown('escape'); | 139 scrollTopBeforeWheelEvent = suggestionList.scrollTop; |
| 136 waitUntilClosing(test2AfterClosing); | 140 dispatchWheelEvent(suggestionList, 0, -100); |
| 141 shouldBecomeEqual('scrollTopBeforeWheelEvent < suggestionList.scrollTop' , 'true', scrollUp); | |
| 142 } | |
| 143 | |
| 144 scrollDown(); | |
| 137 } | 145 } |
| 138 | 146 |
| 139 function test2AfterClosing() { | 147 function test2AfterClosing() { |
| 140 shouldBeNull('$("mock-page-popup")'); | 148 shouldBeNull('$("mock-page-popup")'); |
| 141 | 149 |
| 142 openPicker($('date'), test3); | 150 openPicker($('date'), test3); |
| 143 } | 151 } |
| 144 | 152 |
| 145 function test3() { | 153 function test3() { |
| 146 debug('Check that you can scroll using the scroll bar.'); | 154 debug('Check that you can scroll using the scroll bar.'); |
| 147 | 155 |
| 148 var suggestionList = popupWindow.document.getElementsByClassName("suggestion -list")[0]; | 156 var suggestionList = popupWindow.document.getElementsByClassName("suggestion -list")[0]; |
| 149 var suggestionListOffset = cumulativeOffset(suggestionList); | 157 var suggestionListOffset = cumulativeOffset(suggestionList); |
| 150 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth - popupWindow.getScrollbarWidth() / 2; | 158 var scrollbarCenterX = suggestionListOffset[0] + suggestionList.offsetWidth - popupWindow.getScrollbarWidth() / 2; |
| 151 | 159 |
| 152 scrollTopBeforeWheelEvent = suggestionList.scrollTop; | 160 scrollTopBeforeWheelEvent = suggestionList.scrollTop; |
| 153 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); // 20 is the height of the up arrow button plus a few pixels | 161 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + 20); // 20 is the height of the up arrow button plus a few pixels |
| 154 eventSender.mouseDown(); | 162 eventSender.mouseDown(); |
| 155 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti onList.offsetHeight); | 163 eventSender.mouseMoveTo(scrollbarCenterX, suggestionListOffset[1] + suggesti onList.offsetHeight); |
| 156 eventSender.mouseUp(); | 164 eventSender.mouseUp(); |
| 157 scrollTopAfterWheelEvent = suggestionList.scrollTop; | 165 scrollTopAfterWheelEvent = suggestionList.scrollTop; |
| 158 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); | 166 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); |
| 159 | 167 |
| 160 finishJSTest(); | 168 finishJSTest(); |
| 161 } | 169 } |
| 162 | 170 |
| 163 </script> | 171 </script> |
| 164 </body> | 172 </body> |
| 165 </html> | 173 </html> |
| OLD | NEW |