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

Side by Side Diff: chrome/test/data/webui/settings/settings_main_test.js

Issue 2825203003: MD Settings: Remove subpage animation when landing directly on it. (Closed)
Patch Set: nits Created 3 years, 6 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/browser/resources/settings/settings_ui/settings_ui.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 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 * Extending TestBrowserProxy even though SearchManager is not a browser proxy 7 * Extending TestBrowserProxy even though SearchManager is not a browser proxy
8 * itself. Essentially TestBrowserProxy can act as a "proxy" for any external 8 * itself. Essentially TestBrowserProxy can act as a "proxy" for any external
9 * dependency, not just "browser proxies" (and maybe should be renamed to 9 * dependency, not just "browser proxies" (and maybe should be renamed to
10 * TestProxy). 10 * TestProxy).
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 186 }
187 187
188 // TODO(michaelpg): It would be better not to drill into 188 // TODO(michaelpg): It would be better not to drill into
189 // settings-basic-page. If search should indeed only work in Settings 189 // settings-basic-page. If search should indeed only work in Settings
190 // (as opposed to Advanced), perhaps some of this logic should be 190 // (as opposed to Advanced), perhaps some of this logic should be
191 // delegated to settings-basic-page now instead of settings-main. 191 // delegated to settings-basic-page now instead of settings-main.
192 192
193 /** 193 /**
194 * Asserts the visibility of the basic and advanced pages after exiting 194 * Asserts the visibility of the basic and advanced pages after exiting
195 * search mode. 195 * search mode.
196 * @param {string} Expected 'display' value for the basic page.
197 * @param {string} Expected 'display' value for the advanced page. 196 * @param {string} Expected 'display' value for the advanced page.
198 * @return {!Promise} 197 * @return {!Promise}
199 */ 198 */
200 function assertPageVisibilityAfterSearch( 199 function assertAdvancedVisibilityAfterSearch(expectedAdvanced) {
201 expectedBasic, expectedAdvanced) {
202 searchManager.setMatchesFound(true); 200 searchManager.setMatchesFound(true);
203 return settingsMain.searchContents('Query1').then(function() { 201 return settingsMain.searchContents('Query1')
204 searchManager.setMatchesFound(false); 202 .then(function() {
205 return settingsMain.searchContents(''); 203 searchManager.setMatchesFound(false);
206 }).then(function() { 204 return settingsMain.searchContents('');
207 return assertPageVisibility(expectedBasic, expectedAdvanced); 205 })
208 }); 206 .then(function() {
207 // Imitate behavior of clearing search.
208 settings.navigateTo(settings.Route.BASIC);
209 Polymer.dom.flush();
210 return assertPageVisibility('block', expectedAdvanced);
211 });
209 } 212 }
210 213
211 test('exiting search mode, advanced collapsed', function() { 214 test('exiting search mode, advanced collapsed', function() {
212 // Simulating searching while the advanced page is collapsed. 215 // Simulating searching while the advanced page is collapsed.
213 settingsMain.currentRouteChanged(settings.Route.BASIC); 216 settingsMain.currentRouteChanged(settings.Route.BASIC);
214 Polymer.dom.flush(); 217 Polymer.dom.flush();
215 return assertPageVisibilityAfterSearch('block', 'none'); 218 return assertAdvancedVisibilityAfterSearch('none');
216 }); 219 });
217 220
218 // Ensure that clearing the search results restores both "basic" and 221 // Ensure that clearing the search results restores both "basic" and
219 // "advanced" page, when the search has been initiated from a subpage 222 // "advanced" page, when the search has been initiated from a subpage
220 // whose parent is the "advanced" page. 223 // whose parent is the "advanced" page.
221 test('exiting search mode, advanced expanded', function() { 224 test('exiting search mode, advanced expanded', function() {
222 settings.navigateTo(settings.Route.SITE_SETTINGS); 225 settings.navigateTo(settings.Route.SITE_SETTINGS);
223 Polymer.dom.flush(); 226 Polymer.dom.flush();
224 return assertPageVisibilityAfterSearch('block', 'block'); 227 return assertAdvancedVisibilityAfterSearch('block');
225 }); 228 });
226 229
227 // Ensure that searching, then entering a subpage, then going back 230 // Ensure that searching, then entering a subpage, then going back
228 // lands the user in a page where both basic and advanced sections are 231 // lands the user in a page where both basic and advanced sections are
229 // visible, because the page is still in search mode. 232 // visible, because the page is still in search mode.
230 test('returning from subpage to search results', function() { 233 test('returning from subpage to search results', function() {
231 settings.navigateTo(settings.Route.BASIC); 234 settings.navigateTo(settings.Route.BASIC);
232 Polymer.dom.flush(); 235 Polymer.dom.flush();
233 236
234 searchManager.setMatchesFound(true); 237 searchManager.setMatchesFound(true);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 284
282 return assertPageVisibility('block', 'block'); 285 return assertPageVisibility('block', 'block');
283 }); 286 });
284 }); 287 });
285 } 288 }
286 289
287 return { 290 return {
288 registerTests: registerTests, 291 registerTests: registerTests,
289 }; 292 };
290 }); 293 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/settings_ui/settings_ui.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698