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

Side by Side Diff: chrome/test/data/webui/cr_elements/cr_dialog_test.js

Issue 2843333002: WebUI: restrict cr-dialogs max-height to the viewport. (Closed)
Patch Set: fix test Created 3 years, 7 months 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
« no previous file with comments | « no previous file | ui/webui/resources/cr_elements/cr_dialog/cr_dialog.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 suite('cr-dialog', function() { 5 suite('cr-dialog', function() {
6 function pressEnter(element) { 6 function pressEnter(element) {
7 MockInteractions.keyEventOn(element, 'keypress', 13, undefined, 'Enter'); 7 MockInteractions.keyEventOn(element, 'keypress', 13, undefined, 'Enter');
8 } 8 }
9 9
10 setup(function() { 10 setup(function() {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 assertFalse(bodyContainer.classList.contains('top-scrollable')); 165 assertFalse(bodyContainer.classList.contains('top-scrollable'));
166 assertFalse(bodyContainer.classList.contains('bottom-scrollable')); 166 assertFalse(bodyContainer.classList.contains('bottom-scrollable'));
167 done(); 167 done();
168 }, 1); 168 }, 1);
169 }); 169 });
170 170
171 test('dialog body scrollable border when appropriate', function(done) { 171 test('dialog body scrollable border when appropriate', function(done) {
172 document.body.innerHTML = ` 172 document.body.innerHTML = `
173 <dialog is="cr-dialog" show-scroll-borders> 173 <dialog is="cr-dialog" show-scroll-borders>
174 <div class="title">title</div> 174 <div class="title">title</div>
175 <div class="body">body</div> 175 <div class="body">
176 <div style="height: 100px">tall content</div>
177 </div>
176 </dialog>`; 178 </dialog>`;
177 179
178 var dialog = document.body.querySelector('dialog'); 180 var dialog = document.body.querySelector('dialog');
179 var bodyContainer = dialog.$$('.body-container'); 181 var bodyContainer = dialog.$$('.body-container');
180 assertTrue(!!bodyContainer); 182 assertTrue(!!bodyContainer);
181 183
182 dialog.showModal(); // Attach the dialog for the first time here. 184 dialog.showModal(); // Attach the dialog for the first time here.
183 185
184 var observerCount = 0; 186 var observerCount = 0;
185 187
(...skipping 20 matching lines...) Expand all
206 assertTrue(bodyContainer.classList.contains('bottom-scrollable')); 208 assertTrue(bodyContainer.classList.contains('bottom-scrollable'));
207 assertTrue(bodyContainer.classList.contains('top-scrollable')); 209 assertTrue(bodyContainer.classList.contains('top-scrollable'));
208 observer.disconnect(); 210 observer.disconnect();
209 done(); 211 done();
210 break; 212 break;
211 } 213 }
212 }); 214 });
213 observer.observe(bodyContainer, {attributes: true}); 215 observer.observe(bodyContainer, {attributes: true});
214 216
215 // Height is normally set via CSS, but mixin doesn't work with innerHTML. 217 // Height is normally set via CSS, but mixin doesn't work with innerHTML.
216 bodyContainer.style.height = '1px'; 218 bodyContainer.style.height = '60px'; // Element has "min-height: 60px".
217 bodyContainer.scrollTop = 100; 219 bodyContainer.scrollTop = 100;
218 }); 220 });
219 }); 221 });
OLDNEW
« no previous file with comments | « no previous file | ui/webui/resources/cr_elements/cr_dialog/cr_dialog.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698