Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 verifySectionSubpageVisibilities: function(section) { | |
|
Dan Beam
2016/03/30 03:44:28
verifySubpagesHidden or verifySectionSubpagesHidde
michaelpg
2016/03/30 22:48:03
Done.
| |
| 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 = | |
| 92 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
| |
| 93 | |
| 94 // The section's main child should be stamped and visible. | |
| 95 var main = stampedChildren.filter(element => element.id == 'main'); | |
| 96 assertEquals(main.length, 1, '#main not found for section ' + | |
| 97 section.section); | |
| 98 assertGT(main[0].offsetHeight, 0); | |
| 99 | |
| 100 // Any other stamped subpages should not be visible. | |
| 101 var subpages = stampedChildren.filter(element => element.id != 'main'); | |
| 102 for (var subpage of subpages) { | |
| 103 assertEquals(subpage.offsetHeight, 0, 'Expected subpage #' + subpage.id + | |
| 104 ' in ' + section.section + ' not to be visible.'); | |
| 105 } | |
| 106 }, | |
| 78 }; | 107 }; |
| OLD | NEW |