Chromium Code Reviews| Index: chrome/test/data/webui/cr_elements/cr_dialog_test.js |
| diff --git a/chrome/test/data/webui/cr_elements/cr_dialog_test.js b/chrome/test/data/webui/cr_elements/cr_dialog_test.js |
| index 5f9c1b1fa3be8f5c9797990b7e55b255bc72d60d..479d0c861c84b0fea8c36e80b37ee82bb1b3fbaf 100644 |
| --- a/chrome/test/data/webui/cr_elements/cr_dialog_test.js |
| +++ b/chrome/test/data/webui/cr_elements/cr_dialog_test.js |
| @@ -44,4 +44,35 @@ suite('cr-dialog', function() { |
| expectNotEquals(dialog, document.activeElement); |
| expectEquals(button, document.activeElement); |
| }); |
| + |
| + test('dialog body indicates over-scroll when appropriate', function(done) { |
| + document.body.innerHTML = ` |
| + <dialog is="cr-dialog" show-scroll-borders> |
| + <div class="title">title</div> |
| + <div class="body">body</div> |
| + </dialog>`; |
| + |
| + var dialog = document.body.querySelector('dialog'); |
| + var innerBody = document.body.querySelector('.body'); |
| + var bodyContainer = dialog.$$('.body-container'); |
| + assertTrue(!!bodyContainer); |
| + |
| + // Height is normally set via CSS, but mixin doesn't work with innerHTML. |
| + bodyContainer.style.height = '1px'; |
| + innerBody.style.height = '100px'; |
| + dialog.showModal(); |
| + |
| + return PolymerTest.flushTasks().then(function() { |
|
dpapad
2017/03/31 01:55:26
Optional nit: Perhaps this test is more readable i
scottchen
2017/03/31 18:10:56
Done.
|
| + assertTrue(bodyContainer.classList.contains('bottom-scrollable')); |
| + |
| + var observer = new MutationObserver(function() { |
| + assertFalse(bodyContainer.classList.contains('bottom-scrollable')); |
| + observer.disconnect(); |
| + done(); |
| + }); |
| + observer.observe(bodyContainer, {attributes: true}); |
| + |
| + bodyContainer.scrollTop = 100; |
| + }); |
| + }); |
| }); |