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

Unified Diff: chrome/test/data/webui/cr_elements/cr_dialog_test.js

Issue 2815623005: MD Settings: in cr_dialog, prevent intersectionObserver from firing early. (Closed)
Patch Set: use mutationObserver to not mess with native dialog.open 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 side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698