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 c61de467ea981a9d66a9842d3a3d40d5e9602bbf..7a9b715191063c610bac406796e117460de55873 100644 |
| --- a/chrome/test/data/webui/cr_elements/cr_dialog_test.js |
| +++ b/chrome/test/data/webui/cr_elements/cr_dialog_test.js |
| @@ -145,6 +145,28 @@ suite('cr-dialog', function() { |
| expectEquals(button, document.activeElement); |
| }); |
| + // Ensuring that intersectionObserver does not fire any callbacks before the |
| + // dialog has been opened. |
| + test('body scrollable border not added before modal shown', 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'); |
|
dpapad
2017/04/13 20:31:39
Just to make it explicit, let's also add
assertFa
scottchen
2017/04/13 21:46:04
Done.
|
| + var bodyContainer = dialog.$$('.body-container'); |
| + assertTrue(!!bodyContainer); |
| + |
| + // Waiting for 1ms because IntersectionObserver fires one message loop after |
| + // dialog.attached. |
| + setTimeout(function() { |
| + assertFalse(bodyContainer.classList.contains('top-scrollable')); |
| + assertFalse(bodyContainer.classList.contains('bottom-scrollable')); |
| + done(); |
| + }, 1); |
| + }); |
| + |
| test('dialog body scrollable border when appropriate', function(done) { |
| document.body.innerHTML = ` |
| <dialog is="cr-dialog" show-scroll-borders> |