Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: LayoutTests/platform/chromium/fast/forms/suggestion-picker/date-suggestion-picker-key-operations.html

Issue 11364040: Merge 133011 - Calendar picker can flicker when opened from the suggestion picker (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../../../fast/js/resources/js-test-pre.js"></script> 4 <script src="../../../../../fast/js/resources/js-test-pre.js"></script>
5 <script src="../../../../../fast/forms/resources/picker-common.js"></script> 5 <script src="../../../../../fast/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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 <option>foo</option> <!--invalid--> 82 <option>foo</option> <!--invalid-->
83 </datalist> 83 </datalist>
84 <script> 84 <script>
85 description("Tests that key bindings work as expected."); 85 description("Tests that key bindings work as expected.");
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;
93
92 function test1() { 94 function test1() {
93 debug('Check that page popup exists.'); 95 debug('Check that page popup exists.');
94 shouldBe('popupWindow.pagePopupController.toString()', '"[object PagePopupCo ntroller]"'); 96 shouldBe('popupWindow.pagePopupController.toString()', '"[object PagePopupCo ntroller]"');
95 popupWindow.focus(); 97 popupWindow.focus();
96 98
97 popupWindow.removeEventListener("resize", test1, false);
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 shouldBe('highlightedEntry()', '"2012-01-01"');
103 eventSender.keyDown('downArrow'); 103 eventSender.keyDown('downArrow');
104 shouldBe('highlightedEntry()', '"2012-01-02"'); 104 shouldBe('highlightedEntry()', '"2012-01-02"');
105 eventSender.keyDown('upArrow'); 105 eventSender.keyDown('upArrow');
106 shouldBe('highlightedEntry()', '"2012-01-01"'); 106 shouldBe('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.');
(...skipping 19 matching lines...) Expand all
128 shouldBe('highlightedEntry()', '"@openCalendarPicker"'); 128 shouldBe('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 shouldBe('highlightedEntry()', '"2012-03-08"');
133 eventSender.keyDown("\n"); 133 eventSender.keyDown("\n");
134 shouldBeNull('document.getElementById("mock-page-popup")'); 134 shouldBeNull('document.getElementById("mock-page-popup")');
135 shouldBe('document.getElementById("date").value', '"2012-03-08"'); 135 shouldBe('document.getElementById("date").value', '"2012-03-08"');
136 136
137 debug('Reopen popup.'); 137 debug('Reopen popup.');
138 openPicker(document.getElementById('date')); 138 openPicker(document.getElementById('date'), test2);
139 popupWindow.addEventListener("resize", test2, false);
140 } 139 }
141 140
142 function test2() { 141 function test2() {
143 popupWindow.removeEventListener("resize", test2, false);
144 popupWindow.addEventListener("resize", test3, false);
145
146 popupWindow.focus(); 142 popupWindow.focus();
147 143
148 eventSender.keyDown('pageDown'); 144 eventSender.keyDown('pageDown');
149 eventSender.keyDown('pageDown'); 145 eventSender.keyDown('pageDown');
150 eventSender.keyDown('pageDown'); 146 eventSender.keyDown('pageDown');
151 shouldBe('highlightedEntry()', '"@openCalendarPicker"'); 147 shouldBe('highlightedEntry()', '"@openCalendarPicker"');
152 148
153 debug('Open calendar picker.'); 149 debug('Open calendar picker.');
150 expectingDidHideEvent = true;
151 popupWindow.addEventListener("didHide", testDidHide, false);
152 popupWindow.addEventListener("didOpenPicker", test3, false);
154 eventSender.keyDown('\n'); 153 eventSender.keyDown('\n');
155 } 154 }
156 155
156 function testDidHide() {
157 popupWindow.removeEventListener("didHide", testDidHide);
158
159 shouldBeTrue('expectingDidHideEvent');
160 expectingDidHideEvent = false;
161 }
162
157 function test3() { 163 function test3() {
158 popupWindow.removeEventListener("resize", test3, false); 164 popupWindow.removeEventListener("didOpenPicker", test3);
165
166 shouldBeFalse('expectingDidHideEvent');
159 167
160 debug('Confirm calendar picker did open.'); 168 debug('Confirm calendar picker did open.');
161 shouldBeTrue('popupWindow.document.getElementById("main").classList.contains ("calendar-picker")'); 169 shouldBeTrue('popupWindow.document.getElementById("main").classList.contains ("calendar-picker")');
162 170
163 debug('Check that escape key closes the popup.'); 171 debug('Check that escape key closes the popup.');
164 eventSender.keyDown('\x1B'); 172 eventSender.keyDown('\x1B');
165 shouldBeNull('document.getElementById("mock-page-popup")'); 173 shouldBeNull('document.getElementById("mock-page-popup")');
166 shouldBe('document.getElementById("date").value', '"2012-03-08"'); 174 shouldBe('document.getElementById("date").value', '"2012-03-08"');
167 175
168 sendKey(document.getElementById('date'), "F4"); 176 sendKey(document.getElementById('date'), "F4");
169 if (document.getElementById('mock-page-popup')) 177 if (document.getElementById('mock-page-popup'))
170 testPassed("F4 opened picker."); 178 testPassed("F4 opened picker.");
171 179
172 finishJSTest(); 180 finishJSTest();
173 } 181 }
174 182
175 </script> 183 </script>
176 <script src="../../../../../fast/js/resources/js-test-post.js"></script> 184 <script src="../../../../../fast/js/resources/js-test-post.js"></script>
177 </body> 185 </body>
178 </html> 186 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698