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

Side by Side 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: closure Created 4 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 unified diff | Download patch
« no previous file with comments | « chrome/test/data/webui/settings/device_page_tests.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** @fileoverview Prototype for Settings page tests. */ 5 /** @fileoverview Prototype for Settings page tests. */
6 6
7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */ 7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */
8 var ROOT_PATH = '../../../../../'; 8 var ROOT_PATH = '../../../../../';
9 9
10 // Polymer BrowserTest fixture. 10 // Polymer BrowserTest fixture.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 getSection: function(page, section) { 68 getSection: function(page, section) {
69 var sections = page.shadowRoot.querySelectorAll('settings-section'); 69 var sections = page.shadowRoot.querySelectorAll('settings-section');
70 assertTrue(!!sections); 70 assertTrue(!!sections);
71 for (var i = 0; i < sections.length; ++i) { 71 for (var i = 0; i < sections.length; ++i) {
72 var s = sections[i]; 72 var s = sections[i];
73 if (s.section == section) 73 if (s.section == section)
74 return s; 74 return s;
75 } 75 }
76 return undefined; 76 return undefined;
77 }, 77 },
78
79 /**
80 * Verifies the section has a visible #main element and that any possible
81 * sub-pages are hidden.
82 * @param {!Node} The DOM node for the section.
83 */
84 verifySubpagesHidden: function(section) {
85 // Check if there are sub-pages to verify.
86 var pages = section.querySelector('* /deep/ settings-animated-pages');
87 if (!pages)
88 return;
89
90 var children = pages.getContentChildren();
91 var stampedChildren = children.filter(function(element) {
92 return element.tagName != 'TEMPLATE';
93 });
94
95 // The section's main child should be stamped and visible.
96 var main = stampedChildren.filter(function(element) {
97 return element.id == 'main';
98 });
99 assertEquals(main.length, 1, '#main not found for section ' +
100 section.section);
101 assertGT(main[0].offsetHeight, 0);
102
103 // Any other stamped subpages should not be visible.
104 var subpages = stampedChildren.filter(function(element) {
105 return element.id != 'main';
106 });
107 for (var subpage of subpages) {
108 assertEquals(subpage.offsetHeight, 0, 'Expected subpage #' + subpage.id +
109 ' in ' + section.section + ' not to be visible.');
110 }
111 },
78 }; 112 };
OLDNEW
« no previous file with comments | « chrome/test/data/webui/settings/device_page_tests.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698