| 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 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; |
| 11 | 11 |
| 12 /** @type {?Array<string>} */ | 12 /** @type {?Array<string>} */ |
| 13 var searches = null; | 13 var searches = null; |
| 14 | 14 |
| 15 /** @param {string} term */ | 15 /** @param {string} term */ |
| 16 function simulateSearch(term) { | 16 function simulateSearch(term) { |
| 17 field.$.searchInput.bindValue = term; | 17 field.$.searchInput.bindValue = term; |
| 18 field.onSearchTermSearch(); | 18 field.onSearchTermSearch(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 suiteSetup(function() { | |
| 22 return PolymerTest.importHtml( | |
| 23 'chrome://resources/cr_elements/cr_toolbar/' + | |
| 24 'cr_toolbar_search_field.html'); | |
| 25 }); | |
| 26 | |
| 27 setup(function() { | 21 setup(function() { |
| 28 PolymerTest.clearBody(); | 22 PolymerTest.clearBody(); |
| 29 field = document.createElement('cr-toolbar-search-field'); | 23 field = document.createElement('cr-toolbar-search-field'); |
| 30 searches = []; | 24 searches = []; |
| 31 field.addEventListener('search-changed', function(event) { | 25 field.addEventListener('search-changed', function(event) { |
| 32 searches.push(event.detail); | 26 searches.push(event.detail); |
| 33 }); | 27 }); |
| 34 document.body.appendChild(field); | 28 document.body.appendChild(field); |
| 35 }); | 29 }); |
| 36 | 30 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 86 |
| 93 assertTrue(field.showingSearch); | 87 assertTrue(field.showingSearch); |
| 94 }); | 88 }); |
| 95 }); | 89 }); |
| 96 } | 90 } |
| 97 | 91 |
| 98 return { | 92 return { |
| 99 registerTests: registerTests, | 93 registerTests: registerTests, |
| 100 }; | 94 }; |
| 101 }); | 95 }); |
| OLD | NEW |