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 cr.define('settings_search_engines_page', function() { | 5 cr.define('settings_search_engines_page', function() { |
6 /** | 6 /** |
7 * @param {boolean} canBeDefault | 7 * @param {boolean} canBeDefault |
8 * @param {boolean} canBeEdited | 8 * @param {boolean} canBeEdited |
9 * @param {boolean} canBeRemoved | 9 * @param {boolean} canBeRemoved |
10 * @return {!SearchEngine} | 10 * @return {!SearchEngine} |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 entry = document.createElement('settings-search-engine-entry'); | 155 entry = document.createElement('settings-search-engine-entry'); |
156 entry.set('engine', searchEngine); | 156 entry.set('engine', searchEngine); |
157 document.body.appendChild(entry); | 157 document.body.appendChild(entry); |
158 }); | 158 }); |
159 | 159 |
160 teardown(function() { entry.remove(); }); | 160 teardown(function() { entry.remove(); }); |
161 | 161 |
162 // Test that the <search-engine-entry> is populated according to its | 162 // Test that the <search-engine-entry> is populated according to its |
163 // underlying SearchEngine model. | 163 // underlying SearchEngine model. |
164 test('Initialization', function() { | 164 test('Initialization', function() { |
165 var nameElement = entry.$$('.name'); | 165 var columns = entry.root.querySelectorAll('.column, #url-column'); |
166 assertTrue(!!nameElement); | 166 assertEquals(3, columns.length); |
167 assertEquals(searchEngine.displayName, nameElement.textContent); | |
168 | 167 |
169 var keywordElement = entry.$$('.keyword-column'); | 168 assertEquals(searchEngine.displayName, columns[0].textContent); |
170 assertTrue(!!keywordElement); | 169 assertEquals(searchEngine.keyword, columns[1].textContent); |
171 assertEquals(searchEngine.keyword, keywordElement.textContent); | 170 assertEquals(searchEngine.url, columns[2].textContent); |
172 | |
173 var urlElement = entry.$$('.url-column'); | |
174 assertTrue(!!urlElement); | |
175 assertEquals(searchEngine.url, urlElement.textContent); | |
176 }); | 171 }); |
177 | 172 |
178 test('Remove_Enabled', function() { | 173 test('Remove_Enabled', function() { |
179 // Open action menu. | 174 // Open action menu. |
180 MockInteractions.tap(entry.$$('paper-icon-button')); | 175 MockInteractions.tap(entry.$$('paper-icon-button')); |
181 var menu = entry.$$('dialog[is=cr-action-menu]'); | 176 var menu = entry.$$('dialog[is=cr-action-menu]'); |
182 assertTrue(menu.open); | 177 assertTrue(menu.open); |
183 | 178 |
184 var deleteButton = entry.$.delete; | 179 var deleteButton = entry.$.delete; |
185 assertTrue(!!deleteButton); | 180 assertTrue(!!deleteButton); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 | 373 |
379 return { | 374 return { |
380 registerTests: function() { | 375 registerTests: function() { |
381 registerDialogTests(); | 376 registerDialogTests(); |
382 registerSearchEngineEntryTests(); | 377 registerSearchEngineEntryTests(); |
383 registerOmniboxExtensionEntryTests(); | 378 registerOmniboxExtensionEntryTests(); |
384 registerPageTests(); | 379 registerPageTests(); |
385 }, | 380 }, |
386 }; | 381 }; |
387 }); | 382 }); |
OLD | NEW |