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..0be4224406e26427304d7cd9fdbd70c0cd2137fe 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,32 @@ suite('cr-dialog', function() { |
| expectNotEquals(dialog, document.activeElement); |
| expectEquals(button, document.activeElement); |
| }); |
| + |
| + test('dialog body indicates over-scroll when appropriate', function() { |
| + document.body.innerHTML = ` |
| + <dialog is="cr-dialog" id="dialog"> |
|
dpapad
2017/03/29 17:42:16
Is the id used anywhere?
scottchen
2017/03/29 21:02:08
was, not anymore. Deleting.
|
| + <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. |
|
dpapad
2017/03/29 17:42:16
s/css/CSS
scottchen
2017/03/29 21:02:08
Done.
|
| + bodyContainer.style.height = 1; |
|
dpapad
2017/03/29 17:42:16
Should this be
bodyContainer.style.height = '1px'
scottchen
2017/03/29 21:02:08
I think either way works, but might be more correc
|
| + innerBody.style.height = 100; |
| + dialog.showModal(); |
| + |
| + return PolymerTest.flushTasks() |
| + .then(function() { |
| + assertTrue(bodyContainer.classList.contains('bottom-scrollable')); |
| + bodyContainer.scrollTop = 100; |
| + return PolymerTest.flushTasks(); |
| + }) |
| + .then(function() { |
| + assertFalse(bodyContainer.classList.contains('bottom-scrollable')); |
| + }); |
| + }); |
| }); |