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

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: Update CL after search URLs landed. 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
« 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 /** @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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 }); 127 });
128 128
129 test('search box initiated search propagates to URL', function() { 129 test('search box initiated search propagates to URL', function() {
130 assertFalse(settings.getQueryParameters().has('search')); 130 assertFalse(settings.getQueryParameters().has('search'));
131 var searchField = /** @type {CrToolbarSearchFieldElement} */ ( 131 var searchField = /** @type {CrToolbarSearchFieldElement} */ (
132 toolbar.getSearchField()); 132 toolbar.getSearchField());
133 var value = 'GOOG'; 133 var value = 'GOOG';
134 searchField.setValue(value); 134 searchField.setValue(value);
135 assertEquals(value, settings.getQueryParameters().get('search')); 135 assertEquals(value, settings.getQueryParameters().get('search'));
136 }); 136 });
137
138 test('whitespace only search query is ignored', function() {
139 toolbar = /** @type {!CrToolbarElement} */ (ui.$$('cr-toolbar'));
140 var searchField = /** @type {CrToolbarSearchFieldElement} */ (
141 toolbar.getSearchField());
142 searchField.setValue(' ');
143 var urlParams = settings.getQueryParameters();
144 assertFalse(urlParams.has('search'));
145
146 searchField.setValue(' foo');
147 urlParams = settings.getQueryParameters();
148 assertEquals('foo', urlParams.get('search'));
149
150 searchField.setValue(' foo ');
151 urlParams = settings.getQueryParameters();
152 assertEquals('foo ', urlParams.get('search'));
153
154 searchField.setValue(' ');
155 urlParams = settings.getQueryParameters();
156 assertFalse(urlParams.has('search'));
157 });
137 }); 158 });
138 159
139 mocha.run(); 160 mocha.run();
140 }); 161 });
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