| 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_page', 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} */ |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 // Ensure that clearing the search results restores both "basic" and | 139 // Ensure that clearing the search results restores both "basic" and |
| 140 // "advanced" page, when the search has been initiated from a subpage | 140 // "advanced" page, when the search has been initiated from a subpage |
| 141 // whose parent is the "advanced" page. | 141 // whose parent is the "advanced" page. |
| 142 test('exiting search mode, advanced expanded', function() { | 142 test('exiting search mode, advanced expanded', function() { |
| 143 settings.navigateTo(settings.Route.SITE_SETTINGS); | 143 settings.navigateTo(settings.Route.SITE_SETTINGS); |
| 144 Polymer.dom.flush(); | 144 Polymer.dom.flush(); |
| 145 return assertPageVisibilityAfterSearch('', ''); | 145 return assertPageVisibilityAfterSearch('', ''); |
| 146 }); | 146 }); |
| 147 | 147 |
| 148 // Ensure that searching, then entering a subpage, then going back |
| 149 // lands the user in a page where both basic and advanced sections are |
| 150 // visible, because the page is still in search mode. |
| 151 test('returning from subpage to search results', function() { |
| 152 settings.navigateTo(settings.Route.BASIC); |
| 153 Polymer.dom.flush(); |
| 154 |
| 155 searchManager.setMatchesFound(true); |
| 156 return settingsMain.searchContents('Query1').then(function() { |
| 157 // Simulate navigating into a subpage. |
| 158 settings.navigateTo(settings.Route.SEARCH_ENGINES); |
| 159 settingsMain.$$('settings-basic-page').fire('subpage-expand'); |
| 160 Polymer.dom.flush(); |
| 161 |
| 162 // Simulate clicking the left arrow to go back to the search results. |
| 163 settingsMain.currentRouteChanged(settings.Route.BASIC); |
| 164 Polymer.dom.flush(); |
| 165 assertEquals( |
| 166 '', settingsMain.$$('settings-basic-page').style.display); |
| 167 assertEquals( |
| 168 '', settingsMain.$$('settings-advanced-page').style.display); |
| 169 }); |
| 170 }); |
| 171 |
| 148 test('can collapse advanced on advanced section route', function() { | 172 test('can collapse advanced on advanced section route', function() { |
| 149 settings.navigateTo(settings.Route.PRIVACY); | 173 settings.navigateTo(settings.Route.PRIVACY); |
| 150 Polymer.dom.flush(); | 174 Polymer.dom.flush(); |
| 151 | 175 |
| 152 var advancedToggle = settingsMain.$$('#advancedToggle'); | 176 var advancedToggle = settingsMain.$$('#advancedToggle'); |
| 153 assertTrue(!!advancedToggle); | 177 assertTrue(!!advancedToggle); |
| 154 | 178 |
| 155 MockInteractions.tap(advancedToggle); | 179 MockInteractions.tap(advancedToggle); |
| 156 Polymer.dom.flush(); | 180 Polymer.dom.flush(); |
| 157 | 181 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 170 | 194 |
| 171 assertTrue(settingsMain.showPages_.advanced); | 195 assertTrue(settingsMain.showPages_.advanced); |
| 172 }); | 196 }); |
| 173 }); | 197 }); |
| 174 } | 198 } |
| 175 | 199 |
| 176 return { | 200 return { |
| 177 registerTests: registerTests, | 201 registerTests: registerTests, |
| 178 }; | 202 }; |
| 179 }); | 203 }); |
| OLD | NEW |