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

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

Issue 2090513002: MD Search Field: Properly respond to external changes to search value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 assertEquals(['foo', '', 'bar', 'baz'].join(), searches.join()); 79 assertEquals(['foo', '', 'bar', 'baz'].join(), searches.join());
80 }); 80 });
81 81
82 test('blur does not close field when a search is active', function() { 82 test('blur does not close field when a search is active', function() {
83 MockInteractions.tap(field); 83 MockInteractions.tap(field);
84 simulateSearch('test'); 84 simulateSearch('test');
85 MockInteractions.blur(field.$.searchInput); 85 MockInteractions.blur(field.$.searchInput);
86 86
87 assertTrue(field.showingSearch); 87 assertTrue(field.showingSearch);
88 }); 88 });
89
90 test('opens when value is changed', function() {
91 // Change search value without explicity opening the field first.
92 // Similar to what happens when pasting or dragging into the input
93 // field.
94 simulateSearch('test');
95
96 assertTrue(field.hasSearchText_);
dpapad 2016/06/23 00:44:19 Accessing private variables from within a test end
tsergeant 2016/06/23 01:00:34 Good point, done.
97 assertTrue(field.showingSearch);
98
99 MockInteractions.tap(field.$.clearSearch);
100 assertFalse(field.showingSearch);
101 });
89 }); 102 });
90 } 103 }
91 104
92 return { 105 return {
93 registerTests: registerTests, 106 registerTests: registerTests,
94 }; 107 };
95 }); 108 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698