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

Unified Diff: chrome/browser/resources/settings/settings_ui/settings_ui.js

Issue 2446413002: MD Settings: Ignore whitespace only search queries. (Closed)
Patch Set: Add test. Created 4 years, 2 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 | « no previous file | chrome/test/data/webui/settings/settings_ui_browsertest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/settings/settings_ui/settings_ui.js
diff --git a/chrome/browser/resources/settings/settings_ui/settings_ui.js b/chrome/browser/resources/settings/settings_ui/settings_ui.js
index c2b378aca4c6ccec8608cb973dd4c4426cd55b3e..affd985e7fe567bb46e2415d33c9bf1421d4454a 100644
--- a/chrome/browser/resources/settings/settings_ui/settings_ui.js
+++ b/chrome/browser/resources/settings/settings_ui/settings_ui.js
@@ -131,14 +131,20 @@ Polymer({
* @private
*/
onSearchChanged_: function(e) {
- var query = e.detail;
Dan Beam 2016/10/26 20:51:11 i think this entire patch could be - var query =
dpapad 2016/11/03 21:00:11 See latest patch for a very similar approach.
+ // Ignore query if it contains whitespace only.
+ // TODO(dpapad): Should this be done by cr_search_field_behavior instead?
dpapad 2016/10/25 23:38:41 MD History would probably benefit by moving this l
Dan Beam 2016/10/26 02:10:03 can we just put the fix in a shared place? downlo
+ if (/^\s+$/.test(e.detail))
dpapad 2016/10/25 23:38:41 FWIW, I looked into Downloads, specifically at [1]
+ return;
Dan Beam 2016/10/26 20:51:11 this code is wrong. consider moving from ' a' to
dpapad 2016/11/03 21:00:11 Addressed in latest patch.
+
+ var query = e.detail.trim();
- // 'search-changed' event was fired only because the search box's value was
- // updated to reflect the already existing search URL parameter, no need to
- // navigate again.
var existingQuery = settings.getQueryParameters().get('search') || '';
- if (query == existingQuery)
+ if (query == existingQuery) {
+ // 'search-changed' event was fired only because the search box's value
+ // was updated to reflect the already existing search URL parameter, no
+ // need to navigate again.
return;
+ }
settings.navigateTo(
settings.Route.BASIC,
« no previous file with comments | « no previous file | chrome/test/data/webui/settings/settings_ui_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698