OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 cr.define('settings_main_page', function() { | 5 cr.define('settings_main_search_test', function() { |
6 /** | 6 /** |
7 * @implements {SearchManager} | 7 * @implements {SearchManager} |
8 */ | 8 */ |
9 var TestSearchManager = function() { | 9 var TestSearchManager = function() { |
10 /** @private {boolean} */ | 10 /** @private {boolean} */ |
11 this.matchesFound_ = true; | 11 this.matchesFound_ = true; |
12 | 12 |
13 /** @private {?settings.SearchRequest} */ | 13 /** @private {?settings.SearchRequest} */ |
14 this.searchRequest_ = null; | 14 this.searchRequest_ = null; |
15 } | 15 } |
(...skipping 19 matching lines...) Expand all Loading... |
35 }; | 35 }; |
36 | 36 |
37 function registerTests() { | 37 function registerTests() { |
38 var settingsPrefs = null; | 38 var settingsPrefs = null; |
39 | 39 |
40 suiteSetup(function() { | 40 suiteSetup(function() { |
41 settingsPrefs = document.createElement('settings-prefs'); | 41 settingsPrefs = document.createElement('settings-prefs'); |
42 return CrSettingsPrefs.initialized; | 42 return CrSettingsPrefs.initialized; |
43 }); | 43 }); |
44 | 44 |
45 suite('MainPageTests', function() { | 45 suite('settings-main search', function() { |
46 /** @type {?TestSearchManager} */ | 46 /** @type {?TestSearchManager} */ |
47 var searchManager = null; | 47 var searchManager = null; |
48 | 48 |
49 /** @type {?SettingsMainElement} */ | 49 /** @type {?SettingsMainElement} */ |
50 var settingsMain = null; | 50 var settingsMain = null; |
51 | 51 |
52 setup(function() { | 52 setup(function() { |
53 settings.navigateTo(settings.Route.BASIC); | 53 settings.navigateTo(settings.Route.BASIC); |
54 searchManager = new TestSearchManager(); | 54 searchManager = new TestSearchManager(); |
55 settings.setSearchManagerForTesting(searchManager); | 55 settings.setSearchManagerForTesting(searchManager); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 // Simulate clicking the left arrow to go back to the search results. | 162 // Simulate clicking the left arrow to go back to the search results. |
163 settingsMain.currentRouteChanged(settings.Route.BASIC); | 163 settingsMain.currentRouteChanged(settings.Route.BASIC); |
164 Polymer.dom.flush(); | 164 Polymer.dom.flush(); |
165 assertEquals( | 165 assertEquals( |
166 '', settingsMain.$$('settings-basic-page').style.display); | 166 '', settingsMain.$$('settings-basic-page').style.display); |
167 assertEquals( | 167 assertEquals( |
168 '', settingsMain.$$('settings-advanced-page').style.display); | 168 '', settingsMain.$$('settings-advanced-page').style.display); |
169 }); | 169 }); |
170 }); | 170 }); |
171 | |
172 test('can collapse advanced on advanced section route', function() { | |
173 settings.navigateTo(settings.Route.PRIVACY); | |
174 Polymer.dom.flush(); | |
175 | |
176 var advancedToggle = settingsMain.$$('#advancedToggle'); | |
177 assertTrue(!!advancedToggle); | |
178 | |
179 MockInteractions.tap(advancedToggle); | |
180 Polymer.dom.flush(); | |
181 | |
182 assertFalse(settingsMain.showPages_.advanced); | |
183 }); | |
184 | |
185 test('navigating to a basic page does not collapse advanced', function() { | |
186 settings.navigateTo(settings.Route.PRIVACY); | |
187 Polymer.dom.flush(); | |
188 | |
189 var advancedToggle = settingsMain.$$('#advancedToggle'); | |
190 assertTrue(!!advancedToggle); | |
191 | |
192 settings.navigateTo(settings.Route.PEOPLE); | |
193 Polymer.dom.flush(); | |
194 | |
195 assertTrue(settingsMain.showPages_.advanced); | |
196 }); | |
197 }); | 171 }); |
198 } | 172 } |
199 | 173 |
200 return { | 174 return { |
201 registerTests: registerTests, | 175 registerTests: registerTests, |
202 }; | 176 }; |
203 }); | 177 }); |
OLD | NEW |