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

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: reduce indentation 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
« no previous file with comments | « no previous file | ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..41987dd2d391891460b85490afc7262a36be9d58 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,29 @@ 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');
+ assertFalse(dialog.open);
+ 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>
« no previous file with comments | « no previous file | ui/webui/resources/cr_elements/cr_dialog/cr_dialog.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698