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

Unified Diff: chrome/test/data/webui/settings/settings_main_test.js

Issue 2236723002: MD Settings: Hide the advanced page toggle control during searching. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/settings/settings_main/settings_main.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/settings/settings_main_test.js
diff --git a/chrome/test/data/webui/settings/settings_main_test.js b/chrome/test/data/webui/settings/settings_main_test.js
index e058e921eeff8adf3a8d451b624f3a74d770ba53..efd6eab99a7fbfd339d2dc9ffe29b9d552b6fe3b 100644
--- a/chrome/test/data/webui/settings/settings_main_test.js
+++ b/chrome/test/data/webui/settings/settings_main_test.js
@@ -49,11 +49,6 @@ cr.define('settings_main_page', function() {
/** @type {?SettingsMainElement} */
var settingsMain = null;
- // TODO(tommycli): Remove once settings.navigateTo is no longer a stub.
- settings.navigateTo = function(route) {
- settingsMain.currentRoute = route;
- };
-
setup(function() {
searchManager = new TestSearchManager();
settings.setSearchManagerForTesting(searchManager);
@@ -67,13 +62,19 @@ cr.define('settings_main_page', function() {
teardown(function() { settingsMain.remove(); });
test('no results page shows and hides', function() {
+ Polymer.dom.flush();
var noSearchResults = settingsMain.$.noSearchResults;
assertTrue(!!noSearchResults);
assertTrue(noSearchResults.hidden);
+ var toggleContainer = settingsMain.$$('#toggleContainer');
+ assertTrue(!!toggleContainer);
+ assertNotEquals('none', toggleContainer.style.display);
+
searchManager.setMatchesFound(false);
return settingsMain.searchContents('Query1').then(function() {
assertFalse(noSearchResults.hidden);
+ assertEquals('none', toggleContainer.style.display);
searchManager.setMatchesFound(true);
return settingsMain.searchContents('Query2');
@@ -83,16 +84,42 @@ cr.define('settings_main_page', function() {
});
// Ensure that when the user clears the search box, the "no results" page
- // is hidden.
+ // is hidden and the "advanced page toggle" is visible again.
test('no results page hides on clear', function() {
+ Polymer.dom.flush();
var noSearchResults = settingsMain.$.noSearchResults;
assertTrue(!!noSearchResults);
assertTrue(noSearchResults.hidden);
- searchManager.setMatchesFound(false);
+ var toggleContainer = settingsMain.$$('#toggleContainer');
+ assertTrue(!!toggleContainer);
+ assertNotEquals('none', toggleContainer.style.display);
+
+ searchManager.setMatchesFound(false);
// Clearing the search box is effectively a search for the empty string.
return settingsMain.searchContents('').then(function() {
+ Polymer.dom.flush();
assertTrue(noSearchResults.hidden);
+ assertNotEquals('none', toggleContainer.style.display);
+ });
+ });
+
+ test('advanced page restored after search results cleared', function() {
+ // Simulating searching while the advanced page is collapsed.
+ settingsMain.currentRouteChanged(settings.Route.BASIC);
+ Polymer.dom.flush();
+
+ assertFalse(!!settingsMain.$$('settings-advanced-page'));
+
+ searchManager.setMatchesFound(true);
+ return settingsMain.searchContents('Query1').then(function() {
+ searchManager.setMatchesFound(false);
+ return settingsMain.searchContents('');
+ }).then(function() {
+ Polymer.dom.flush();
+ // Checking that it remains hidden after results are cleared.
+ assertEquals(
+ 'none', settingsMain.$$('settings-advanced-page').style.display);
});
});
});
« no previous file with comments | « chrome/browser/resources/settings/settings_main/settings_main.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698