| OLD | NEW |
| 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 Loading... |
| 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 }); |
| OLD | NEW |