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

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

Issue 2446413002: MD Settings: Ignore whitespace only search queries. (Closed)
Patch Set: Add test. Created 4 years, 1 month 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
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 /** @fileoverview Suite of tests for the Settings layout. */ 5 /** @fileoverview Suite of tests for the Settings layout. */
6 6
7 GEN_INCLUDE(['settings_page_browsertest.js']); 7 GEN_INCLUDE(['settings_page_browsertest.js']);
8 8
9 /** 9 /**
10 * @constructor 10 * @constructor
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 toolbar.getSearchField()); 118 toolbar.getSearchField());
119 119
120 var query = 'foo'; 120 var query = 'foo';
121 settings.navigateTo( 121 settings.navigateTo(
122 settings.Route.BASIC, new URLSearchParams(`search=${query}`)); 122 settings.Route.BASIC, new URLSearchParams(`search=${query}`));
123 assertEquals(query, searchField.getSearchInput().bindValue); 123 assertEquals(query, searchField.getSearchInput().bindValue);
124 124
125 settings.navigateTo(settings.Route.BASIC); 125 settings.navigateTo(settings.Route.BASIC);
126 assertEquals('', searchField.getSearchInput().bindValue); 126 assertEquals('', searchField.getSearchInput().bindValue);
127 }); 127 });
128
129 test('whitespace only search query is ignored', function() {
130 toolbar = /** @type {!CrToolbarElement} */ (ui.$$('cr-toolbar'));
131 var searchField = /** @type {CrToolbarSearchFieldElement} */ (
132 toolbar.getSearchField());
133 searchField.setValue(' ');
134
135 var urlParams = settings.getQueryParameters();
136 assertFalse(urlParams.has('search'));
137 });
128 }); 138 });
129 139
130 mocha.run(); 140 mocha.run();
131 }); 141 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698