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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 var router = document.querySelector('cr-settings').$$('settings-ui') | 79 var router = document.querySelector('cr-settings').$$('settings-ui') |
80 .$$('settings-router'); | 80 .$$('settings-router'); |
81 assert(!!router); | 81 assert(!!router); |
82 return router; | 82 return router; |
83 }, | 83 }, |
84 | 84 |
85 /** | 85 /** |
86 * @return {boolean} True if the router's state is a root page, e.g. Basic. | 86 * @return {boolean} True if the router's state is a root page, e.g. Basic. |
87 */ | 87 */ |
88 isAtRoot: function() { | 88 isAtRoot: function() { |
89 var router = this.getRouter(); | 89 var route = this.getRouter().currentRoute; |
90 return router.section == '' && router.subpage.length == 0; | 90 return route.section == '' && route.subpage.length == 0; |
tommycli
2016/07/20 21:33:02
Also perhaps it would be even clearer to check
ro
| |
91 }, | 91 }, |
92 | 92 |
93 /** Navigates to the current root page, e.g. Basic. */ | 93 /** Navigates to the current root page, e.g. Basic. */ |
94 backToRoot: function() { | 94 backToRoot: function() { |
95 var router = document.querySelector('cr-settings').$$('settings-ui') | 95 var router = document.querySelector('cr-settings').$$('settings-ui') |
96 .$$('settings-router'); | 96 .$$('settings-router'); |
97 router.currentRoute = { | 97 router.currentRoute = { |
98 page: router.currentRoute.page, | 98 page: router.currentRoute.page, |
99 section: '', | 99 section: '', |
100 subpage: [], | 100 subpage: [], |
(...skipping 27 matching lines...) Expand all Loading... | |
128 // Any other stamped subpages should not be visible. | 128 // Any other stamped subpages should not be visible. |
129 var subpages = stampedChildren.filter(function(element) { | 129 var subpages = stampedChildren.filter(function(element) { |
130 return element.id != 'main'; | 130 return element.id != 'main'; |
131 }); | 131 }); |
132 for (var subpage of subpages) { | 132 for (var subpage of subpages) { |
133 assertEquals(subpage.offsetHeight, 0, 'Expected subpage #' + subpage.id + | 133 assertEquals(subpage.offsetHeight, 0, 'Expected subpage #' + subpage.id + |
134 ' in ' + section.section + ' not to be visible.'); | 134 ' in ' + section.section + ' not to be visible.'); |
135 } | 135 } |
136 }, | 136 }, |
137 }; | 137 }; |
OLD | NEW |