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 columns = entry.root.querySelectorAll('.column, #url-column'); | 165 assertEquals( |
166 assertEquals(3, columns.length); | 166 searchEngine.displayName, |
167 | 167 entry.root.querySelector('#name-column').textContent.trim()); |
168 assertEquals(searchEngine.displayName, columns[0].textContent); | 168 assertEquals( |
169 assertEquals(searchEngine.keyword, columns[1].textContent); | 169 searchEngine.keyword, |
170 assertEquals(searchEngine.url, columns[2].textContent); | 170 entry.root.querySelector('#keyword-column').textContent); |
| 171 assertEquals( |
| 172 searchEngine.url, |
| 173 entry.root.querySelector('#url-column').textContent); |
171 }); | 174 }); |
172 | 175 |
173 test('Remove_Enabled', function() { | 176 test('Remove_Enabled', function() { |
174 // Open action menu. | 177 // Open action menu. |
175 MockInteractions.tap(entry.$$('paper-icon-button')); | 178 MockInteractions.tap(entry.$$('paper-icon-button')); |
176 var menu = entry.$$('dialog[is=cr-action-menu]'); | 179 var menu = entry.$$('dialog[is=cr-action-menu]'); |
177 assertTrue(menu.open); | 180 assertTrue(menu.open); |
178 | 181 |
179 var deleteButton = entry.$.delete; | 182 var deleteButton = entry.$.delete; |
180 assertTrue(!!deleteButton); | 183 assertTrue(!!deleteButton); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 | 386 |
384 return { | 387 return { |
385 registerTests: function() { | 388 registerTests: function() { |
386 registerDialogTests(); | 389 registerDialogTests(); |
387 registerSearchEngineEntryTests(); | 390 registerSearchEngineEntryTests(); |
388 registerOmniboxExtensionEntryTests(); | 391 registerOmniboxExtensionEntryTests(); |
389 registerPageTests(); | 392 registerPageTests(); |
390 }, | 393 }, |
391 }; | 394 }; |
392 }); | 395 }); |
OLD | NEW |