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

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

Issue 2702523005: MD Settings: long dialog body should have overscroll line. (Closed)
Patch Set: revert format change Created 3 years, 8 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
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 setup(function() { 6 setup(function() {
7 PolymerTest.clearBody(); 7 PolymerTest.clearBody();
8 }); 8 });
9 9
10 test('focuses title on show', function() { 10 test('focuses title on show', function() {
(...skipping 26 matching lines...) Expand all
37 var button = document.body.querySelector('button'); 37 var button = document.body.querySelector('button');
38 38
39 assertNotEquals(dialog, document.activeElement); 39 assertNotEquals(dialog, document.activeElement);
40 assertNotEquals(button, document.activeElement); 40 assertNotEquals(button, document.activeElement);
41 41
42 dialog.showModal(); 42 dialog.showModal();
43 43
44 expectNotEquals(dialog, document.activeElement); 44 expectNotEquals(dialog, document.activeElement);
45 expectEquals(button, document.activeElement); 45 expectEquals(button, document.activeElement);
46 }); 46 });
47
48 test('dialog body indicates over-scroll when appropriate', function() {
49 document.body.innerHTML = `
50 <dialog is="cr-dialog" show-scroll-borders>
51 <div class="title">title</div>
52 <div class="body">body</div>
53 </dialog>`;
54
55 var dialog = document.body.querySelector('dialog');
56 var innerBody = document.body.querySelector('.body');
57 var bodyContainer = dialog.$$('.body-container');
58 assertTrue(!!bodyContainer);
59
60 // Height is normally set via CSS, but mixin doesn't work with innerHTML.
61 bodyContainer.style.height = '1px';
62 innerBody.style.height = '100px';
63 dialog.showModal();
64
65 return PolymerTest.flushTasks()
66 .then(function() {
67 assertTrue(bodyContainer.classList.contains('bottom-scrollable'));
68 bodyContainer.scrollTop = 100;
69 return PolymerTest.flushTasks();
70 })
71 .then(function() {
72 assertFalse(bodyContainer.classList.contains('bottom-scrollable'));
73 });
74 });
47 }); 75 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698