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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 <option>foo</option> <!--invalid--> | 84 <option>foo</option> <!--invalid--> |
85 </datalist> | 85 </datalist> |
86 <script> | 86 <script> |
87 debug('Check that page popup doesn\'t exist at first.'); | 87 debug('Check that page popup doesn\'t exist at first.'); |
88 shouldBeNull('$("mock-page-popup")'); | 88 shouldBeNull('$("mock-page-popup")'); |
89 | 89 |
90 openPicker($('date'), test1); | 90 openPicker($('date'), test1); |
91 | 91 |
92 function test1() { | 92 function test1() { |
93 debug('Check that page popup exists.'); | 93 debug('Check that page popup exists.'); |
94 shouldBe('popupWindow.pagePopupController.toString()', '"[object PagePopupCo
ntroller]"'); | 94 shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object
PagePopupController]'); |
95 | 95 |
96 debug('Check that hovering over an entry highlights it.'); | 96 debug('Check that hovering over an entry highlights it.'); |
97 hoverOverElement(popupWindow.document.querySelector(".suggestion-list-entry:
nth-child(2)")); | 97 hoverOverElement(popupWindow.document.querySelector(".suggestion-list-entry:
nth-child(2)")); |
98 shouldBe('highlightedEntry()', '"2012-01-02"'); | 98 shouldBeEqualToString('highlightedEntry()', '2012-01-02'); |
99 | 99 |
100 debug('Check that moving the mouse outside the popup de-highlights entries.'
); | 100 debug('Check that moving the mouse outside the popup de-highlights entries.'
); |
101 hoverOverElement(document.getElementById('description')); | 101 hoverOverElement(document.getElementById('description')); |
102 shouldBeNull('highlightedEntry()'); | 102 shouldBeNull('highlightedEntry()'); |
103 | 103 |
104 debug('Check that mouse click closes the popup and sets the value.'); | 104 debug('Check that mouse click closes the popup and sets the value.'); |
105 clickElement(popupWindow.document.querySelector(".suggestion-list-entry:nth-
child(3)")); | 105 clickElement(popupWindow.document.querySelector(".suggestion-list-entry:nth-
child(3)")); |
106 waitUntilClosing(test1AfterClosing); | 106 waitUntilClosing(test1AfterClosing); |
107 } | 107 } |
108 | 108 |
109 function test1AfterClosing() { | 109 function test1AfterClosing() { |
110 shouldBeNull('$("mock-page-popup")'); | 110 shouldBeNull('$("mock-page-popup")'); |
111 shouldBe('document.getElementById("date").value', '"2012-01-03"'); | 111 shouldBeEqualToString('document.getElementById("date").value', '2012-01-03')
; |
112 | 112 |
113 openPicker($('date'), test2); | 113 openPicker($('date'), test2); |
114 } | 114 } |
115 | 115 |
116 var scrollTopBeforeWheelEvent = 0; | 116 var scrollTopBeforeWheelEvent = 0; |
117 var scrollTopAfterWheelEvent = 0; | 117 var scrollTopAfterWheelEvent = 0; |
118 | 118 |
119 function test2() { | 119 function test2() { |
120 var suggestionList = popupWindow.document.getElementsByClassName("suggestion
-list")[0]; | 120 var suggestionList = popupWindow.document.getElementsByClassName("suggestion
-list")[0]; |
121 | 121 |
122 debug('Check that you can scroll using the mouse wheel.'); | 122 debug('Check that you can scroll using the mouse wheel.'); |
123 | 123 |
124 scrollTopBeforeWheelEvent = suggestionList.scrollTop; | 124 scrollTopBeforeWheelEvent = suggestionList.scrollTop; |
125 dispatchWheelEvent(suggestionList, 0, -100); | 125 dispatchWheelEvent(suggestionList, 0, -100); |
126 scrollTopAfterWheelEvent = suggestionList.scrollTop; | 126 scrollTopAfterWheelEvent = suggestionList.scrollTop; |
127 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); | 127 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); |
128 | 128 |
129 scrollTopBeforeWheelEvent = suggestionList.scrollTop; | 129 scrollTopBeforeWheelEvent = suggestionList.scrollTop; |
130 dispatchWheelEvent(suggestionList, 0, 100); | 130 dispatchWheelEvent(suggestionList, 0, 100); |
131 scrollTopAfterWheelEvent = suggestionList.scrollTop; | 131 scrollTopAfterWheelEvent = suggestionList.scrollTop; |
132 shouldBeTrue('scrollTopBeforeWheelEvent > scrollTopAfterWheelEvent'); | 132 shouldBeTrue('scrollTopBeforeWheelEvent > scrollTopAfterWheelEvent'); |
133 | 133 |
134 popupWindow.focus(); | 134 popupWindow.focus(); |
135 eventSender.keyDown('\x1B'); | 135 eventSender.keyDown('escape'); |
136 waitUntilClosing(test2AfterClosing); | 136 waitUntilClosing(test2AfterClosing); |
137 } | 137 } |
138 | 138 |
139 function test2AfterClosing() { | 139 function test2AfterClosing() { |
140 shouldBeNull('$("mock-page-popup")'); | 140 shouldBeNull('$("mock-page-popup")'); |
141 | 141 |
142 openPicker($('date'), test3); | 142 openPicker($('date'), test3); |
143 } | 143 } |
144 | 144 |
145 function test3() { | 145 function test3() { |
(...skipping 10 matching lines...) Expand all Loading... |
156 eventSender.mouseUp(); | 156 eventSender.mouseUp(); |
157 scrollTopAfterWheelEvent = suggestionList.scrollTop; | 157 scrollTopAfterWheelEvent = suggestionList.scrollTop; |
158 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); | 158 shouldBeTrue('scrollTopBeforeWheelEvent < scrollTopAfterWheelEvent'); |
159 | 159 |
160 finishJSTest(); | 160 finishJSTest(); |
161 } | 161 } |
162 | 162 |
163 </script> | 163 </script> |
164 </body> | 164 </body> |
165 </html> | 165 </html> |
OLD | NEW |