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 style="background-color: #bbbbbb;"> | 8 <body style="background-color: #bbbbbb;"> |
9 <p id="description"></p> | 9 <p id="description"></p> |
10 <div id="console"></div> | 10 <div id="console"></div> |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 debug('Check that page popup doesn\'t exist at first.'); | 87 debug('Check that page popup doesn\'t exist at first.'); |
88 shouldBeNull('document.getElementById("mock-page-popup")'); | 88 shouldBeNull('document.getElementById("mock-page-popup")'); |
89 | 89 |
90 openPicker(document.getElementById('date'), test1); | 90 openPicker(document.getElementById('date'), test1); |
91 | 91 |
92 var expectingDidHideEvent = false; | 92 var expectingDidHideEvent = false; |
93 | 93 |
94 function test1() { | 94 function test1() { |
95 debug('Check that page popup exists.'); | 95 debug('Check that page popup exists.'); |
96 shouldBe('popupWindow.pagePopupController.toString()', '"[object PagePopupCo
ntroller]"'); | 96 shouldBeEqualToString('popupWindow.pagePopupController.toString()', '[object
PagePopupController]'); |
97 popupWindow.focus(); | 97 popupWindow.focus(); |
98 | 98 |
99 debug('Check that up/down arrow keys work.'); | 99 debug('Check that up/down arrow keys work.'); |
100 shouldBeNull('highlightedEntry()'); | 100 shouldBeNull('highlightedEntry()'); |
101 eventSender.keyDown('downArrow'); | 101 eventSender.keyDown('downArrow'); |
102 shouldBe('highlightedEntry()', '"2012-01-01"'); | 102 shouldBeEqualToString('highlightedEntry()', '2012-01-01'); |
103 eventSender.keyDown('downArrow'); | 103 eventSender.keyDown('downArrow'); |
104 shouldBe('highlightedEntry()', '"2012-01-02"'); | 104 shouldBeEqualToString('highlightedEntry()', '2012-01-02'); |
105 eventSender.keyDown('upArrow'); | 105 eventSender.keyDown('upArrow'); |
106 shouldBe('highlightedEntry()', '"2012-01-01"'); | 106 shouldBeEqualToString('highlightedEntry()', '2012-01-01'); |
107 | 107 |
108 debug('Check that up arrow key at top of list does nothing.'); | 108 debug('Check that up arrow key at top of list does nothing.'); |
109 eventSender.keyDown('upArrow'); | 109 eventSender.keyDown('upArrow'); |
110 shouldBe('highlightedEntry()', '"2012-01-01"'); | 110 shouldBeEqualToString('highlightedEntry()', '2012-01-01'); |
111 eventSender.keyDown('downArrow'); | 111 eventSender.keyDown('downArrow'); |
112 shouldBe('highlightedEntry()', '"2012-01-02"'); | 112 shouldBeEqualToString('highlightedEntry()', '2012-01-02'); |
113 | 113 |
114 debug('Check that page up/down arrow keys work.'); | 114 debug('Check that page up/down arrow keys work.'); |
115 eventSender.keyDown('pageDown'); | 115 eventSender.keyDown('pageDown'); |
116 shouldBe('highlightedEntry()', '"2012-02-09"'); | 116 shouldBeEqualToString('highlightedEntry()', '2012-02-09'); |
117 eventSender.keyDown('pageDown'); | 117 eventSender.keyDown('pageDown'); |
118 shouldBe('highlightedEntry()', '"2012-02-29"'); | 118 shouldBeEqualToString('highlightedEntry()', '2012-02-29'); |
119 eventSender.keyDown('pageUp'); | 119 eventSender.keyDown('pageUp'); |
120 shouldBe('highlightedEntry()', '"2012-01-21"'); | 120 shouldBeEqualToString('highlightedEntry()', '2012-01-21'); |
121 eventSender.keyDown('pageDown'); | 121 eventSender.keyDown('pageDown'); |
122 shouldBe('highlightedEntry()', '"2012-02-29"'); | 122 shouldBeEqualToString('highlightedEntry()', '2012-02-29'); |
123 eventSender.keyDown('pageDown'); | 123 eventSender.keyDown('pageDown'); |
124 shouldBe('highlightedEntry()', '"@openCalendarPicker"'); | 124 shouldBeEqualToString('highlightedEntry()', '@openCalendarPicker'); |
125 | 125 |
126 debug('Check that down arrow key at bottom of list does nothing.'); | 126 debug('Check that down arrow key at bottom of list does nothing.'); |
127 eventSender.keyDown('downArrow'); | 127 eventSender.keyDown('downArrow'); |
128 shouldBe('highlightedEntry()', '"@openCalendarPicker"'); | 128 shouldBeEqualToString('highlightedEntry()', '@openCalendarPicker'); |
129 | 129 |
130 debug('Check that enter key sets the highlighted value.'); | 130 debug('Check that enter key sets the highlighted value.'); |
131 eventSender.keyDown('upArrow'); | 131 eventSender.keyDown('upArrow'); |
132 shouldBe('highlightedEntry()', '"2012-03-08"'); | 132 shouldBeEqualToString('highlightedEntry()', '2012-03-08'); |
133 eventSender.keyDown("\n"); | 133 eventSender.keyDown("\n"); |
134 waitUntilClosing(test1AfterClosing); | 134 waitUntilClosing(test1AfterClosing); |
135 } | 135 } |
136 | 136 |
137 function test1AfterClosing() { | 137 function test1AfterClosing() { |
138 shouldBeNull('document.getElementById("mock-page-popup")'); | 138 shouldBeNull('document.getElementById("mock-page-popup")'); |
139 shouldBe('document.getElementById("date").value', '"2012-03-08"'); | 139 shouldBeEqualToString('document.getElementById("date").value', '2012-03-08')
; |
140 | 140 |
141 debug('Reopen popup.'); | 141 debug('Reopen popup.'); |
142 openPicker(document.getElementById('date'), test2); | 142 openPicker(document.getElementById('date'), test2); |
143 } | 143 } |
144 | 144 |
145 function test2() { | 145 function test2() { |
146 popupWindow.focus(); | 146 popupWindow.focus(); |
147 | 147 |
148 eventSender.keyDown('pageDown'); | 148 eventSender.keyDown('pageDown'); |
149 eventSender.keyDown('pageDown'); | 149 eventSender.keyDown('pageDown'); |
150 eventSender.keyDown('pageDown'); | 150 eventSender.keyDown('pageDown'); |
151 shouldBe('highlightedEntry()', '"@openCalendarPicker"'); | 151 shouldBeEqualToString('highlightedEntry()', '@openCalendarPicker'); |
152 | 152 |
153 debug('Open calendar picker.'); | 153 debug('Open calendar picker.'); |
154 expectingDidHideEvent = true; | 154 expectingDidHideEvent = true; |
155 popupWindow.addEventListener("didHide", testDidHide, false); | 155 popupWindow.addEventListener("didHide", testDidHide, false); |
156 popupWindow.addEventListener("didOpenPicker", test3, false); | 156 popupWindow.addEventListener("didOpenPicker", test3, false); |
157 eventSender.keyDown('\n'); | 157 eventSender.keyDown('\n'); |
158 } | 158 } |
159 | 159 |
160 function testDidHide() { | 160 function testDidHide() { |
161 popupWindow.removeEventListener("didHide", testDidHide); | 161 popupWindow.removeEventListener("didHide", testDidHide); |
162 | 162 |
163 shouldBeTrue('expectingDidHideEvent'); | 163 shouldBeTrue('expectingDidHideEvent'); |
164 expectingDidHideEvent = false; | 164 expectingDidHideEvent = false; |
165 } | 165 } |
166 | 166 |
167 function test3() { | 167 function test3() { |
168 popupWindow.removeEventListener("didOpenPicker", test3); | 168 popupWindow.removeEventListener("didOpenPicker", test3); |
169 | 169 |
170 shouldBeFalse('expectingDidHideEvent'); | 170 shouldBeFalse('expectingDidHideEvent'); |
171 | 171 |
172 debug('Confirm calendar picker did open.'); | 172 debug('Confirm calendar picker did open.'); |
173 shouldBeTrue('popupWindow.document.getElementById("main").firstChild.classLi
st.contains("calendar-picker")'); | 173 shouldBeTrue('popupWindow.document.getElementById("main").firstChild.classLi
st.contains("calendar-picker")'); |
174 | 174 |
175 debug('Check that escape key closes the popup.'); | 175 debug('Check that escape key closes the popup.'); |
176 eventSender.keyDown('\x1B'); | 176 eventSender.keyDown('escape'); |
177 waitUntilClosing(test3AfterClosing); | 177 waitUntilClosing(test3AfterClosing); |
178 } | 178 } |
179 | 179 |
180 function test3AfterClosing() { | 180 function test3AfterClosing() { |
181 shouldBeNull('document.getElementById("mock-page-popup")'); | 181 shouldBeNull('document.getElementById("mock-page-popup")'); |
182 shouldBe('document.getElementById("date").value', '"2012-03-08"'); | 182 shouldBeEqualToString('document.getElementById("date").value', '2012-03-08')
; |
183 | 183 |
184 sendKey(document.getElementById('date'), "F4"); | 184 sendKey(document.getElementById('date'), "F4"); |
185 if (document.getElementById('mock-page-popup')) | 185 if (document.getElementById('mock-page-popup')) |
186 testPassed("F4 opened picker."); | 186 testPassed("F4 opened picker."); |
187 | 187 |
188 finishJSTest(); | 188 finishJSTest(); |
189 } | 189 } |
190 | 190 |
191 </script> | 191 </script> |
192 </body> | 192 </body> |
193 </html> | 193 </html> |
OLD | NEW |