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

Side by Side Diff: chrome/test/data/webui/cr_elements/cr_toolbar_search_field_tests.js

Issue 2075453002: WebUI cr-search-field: Trigger event after programmatically clearing query. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test. Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js » ('j') | 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 cr-toolbar-search-field. */ 5 /** @fileoverview Suite of tests for cr-toolbar-search-field. */
6 cr.define('cr_toolbar_search_field', function() { 6 cr.define('cr_toolbar_search_field', function() {
7 function registerTests() { 7 function registerTests() {
8 suite('cr-toolbar-search-field', function() { 8 suite('cr-toolbar-search-field', function() {
9 /** @type {?CrToolbarSearchFieldElement} */ 9 /** @type {?CrToolbarSearchFieldElement} */
10 var field = null; 10 var field = null;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 assertFalse(field.showingSearch); 67 assertFalse(field.showingSearch);
68 assertEquals('', field.getValue()); 68 assertEquals('', field.getValue());
69 69
70 simulateSearch('query2'); 70 simulateSearch('query2');
71 // Expecting identical query to be ignored. 71 // Expecting identical query to be ignored.
72 simulateSearch('query2'); 72 simulateSearch('query2');
73 73
74 assertEquals(['query1', '', 'query2'].join(), searches.join()); 74 assertEquals(['query1', '', 'query2'].join(), searches.join());
75 }); 75 });
76 76
77 test('notifies on setValue', function() {
78 MockInteractions.tap(field);
79 field.setValue('foo');
80 field.setValue('');
81 field.setValue('bar');
82 // Expecting identical query to be ignored.
83 field.setValue('bar');
84 field.setValue('baz');
85 assertEquals(['foo', '', 'bar', 'baz'].join(), searches.join());
86 });
87
77 test('blur does not close field when a search is active', function() { 88 test('blur does not close field when a search is active', function() {
78 MockInteractions.tap(field); 89 MockInteractions.tap(field);
79 simulateSearch('test'); 90 simulateSearch('test');
80 MockInteractions.blur(field.$.searchInput); 91 MockInteractions.blur(field.$.searchInput);
81 92
82 assertTrue(field.showingSearch); 93 assertTrue(field.showingSearch);
83 }); 94 });
84 }); 95 });
85 } 96 }
86 97
87 return { 98 return {
88 registerTests: registerTests, 99 registerTests: registerTests,
89 }; 100 };
90 }); 101 });
OLDNEW
« no previous file with comments | « no previous file | ui/webui/resources/cr_elements/cr_search_field/cr_search_field_behavior.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698