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

Unified Diff: chrome/test/data/webui/settings/settings_page_browsertest.js

Issue 1826683002: MD Settings: Lazy-load sub-pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WebAnimationsExterns
Patch Set: no-op Created 4 years, 9 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/settings/settings_page_browsertest.js
diff --git a/chrome/test/data/webui/settings/settings_page_browsertest.js b/chrome/test/data/webui/settings/settings_page_browsertest.js
index 36a8fde7cdb05ad7f14a6c7cca0c314f97c92868..7a4deeea8d68d789f12d3e07d5b669b0a7509ce8 100644
--- a/chrome/test/data/webui/settings/settings_page_browsertest.js
+++ b/chrome/test/data/webui/settings/settings_page_browsertest.js
@@ -75,4 +75,33 @@ SettingsPageBrowserTest.prototype = {
}
return undefined;
},
+
+ /**
+ * Verifies the section has a visible #main element and that any possible
+ * sub-pages are hidden.
+ * @param {!Node} The DOM node for the section.
+ */
+ verifySectionSubpageVisibilities: function(section) {
Dan Beam 2016/03/30 03:44:28 verifySubpagesHidden or verifySectionSubpagesHidde
michaelpg 2016/03/30 22:48:03 Done.
+ // Check if there are sub-pages to verify.
+ var pages = section.querySelector('* /deep/ settings-animated-pages');
+ if (!pages)
+ return;
+
+ var children = pages.getContentChildren();
+ var stampedChildren =
+ children.filter(element => element.tagName != 'TEMPLATE');
Dan Beam 2016/03/30 03:44:27 hope the linter doesn't whine
michaelpg 2016/03/30 22:48:03 apparently the linter only applies to chrome/brows
+
+ // The section's main child should be stamped and visible.
+ var main = stampedChildren.filter(element => element.id == 'main');
+ assertEquals(main.length, 1, '#main not found for section ' +
+ section.section);
+ assertGT(main[0].offsetHeight, 0);
+
+ // Any other stamped subpages should not be visible.
+ var subpages = stampedChildren.filter(element => element.id != 'main');
+ for (var subpage of subpages) {
+ assertEquals(subpage.offsetHeight, 0, 'Expected subpage #' + subpage.id +
+ ' in ' + section.section + ' not to be visible.');
+ }
+ },
};

Powered by Google App Engine
This is Rietveld 408576698