| 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_startup_urls_page', function() { | 5 cr.define('settings_startup_urls_page', function() { |
| 6 /** | 6 /** |
| 7 * @constructor | 7 * @constructor |
| 8 * @implements {settings.StartupUrlsPageBrowserProxy} | 8 * @implements {settings.StartupUrlsPageBrowserProxy} |
| 9 * @extends {settings.TestBrowserProxy} | 9 * @extends {settings.TestBrowserProxy} |
| 10 */ | 10 */ |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 test('AddStartupPage', function() { | 176 test('AddStartupPage', function() { |
| 177 document.body.appendChild(dialog); | 177 document.body.appendChild(dialog); |
| 178 return testProxyCalled('addStartupPage'); | 178 return testProxyCalled('addStartupPage'); |
| 179 }); | 179 }); |
| 180 | 180 |
| 181 test('EditStartupPage', function() { | 181 test('EditStartupPage', function() { |
| 182 dialog.model = createSampleUrlEntry(); | 182 dialog.model = createSampleUrlEntry(); |
| 183 document.body.appendChild(dialog); | 183 document.body.appendChild(dialog); |
| 184 return testProxyCalled('editStartupPage'); | 184 return testProxyCalled('editStartupPage'); |
| 185 }); | 185 }); |
| 186 |
| 187 test('Enter key submits', function() { |
| 188 document.body.appendChild(dialog); |
| 189 |
| 190 // Input a URL and force validation. |
| 191 var inputElement = dialog.$.url; |
| 192 inputElement.value = 'foo.com'; |
| 193 pressSpace(inputElement); |
| 194 |
| 195 return browserProxy.whenCalled('validateStartupPage').then(function() { |
| 196 MockInteractions.keyEventOn( |
| 197 inputElement, 'keypress', 13, undefined, 'Enter'); |
| 198 |
| 199 return browserProxy.whenCalled('addStartupPage'); |
| 200 }); |
| 201 }); |
| 186 }); | 202 }); |
| 187 | 203 |
| 188 suite('StartupUrlsPage', function() { | 204 suite('StartupUrlsPage', function() { |
| 189 /** @type {?SettingsStartupUrlsPageElement} */ | 205 /** @type {?SettingsStartupUrlsPageElement} */ |
| 190 var page = null; | 206 var page = null; |
| 191 | 207 |
| 192 var browserProxy = null; | 208 var browserProxy = null; |
| 193 | 209 |
| 194 setup(function() { | 210 setup(function() { |
| 195 browserProxy = new TestStartupUrlsPageBrowserProxy(); | 211 browserProxy = new TestStartupUrlsPageBrowserProxy(); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 test('Editable', function() { | 352 test('Editable', function() { |
| 337 assertFalse(!!element.editable); | 353 assertFalse(!!element.editable); |
| 338 assertFalse(!!element.$$('#dots')); | 354 assertFalse(!!element.$$('#dots')); |
| 339 | 355 |
| 340 element.editable = true; | 356 element.editable = true; |
| 341 Polymer.dom.flush(); | 357 Polymer.dom.flush(); |
| 342 assertTrue(!!element.$$('#dots')); | 358 assertTrue(!!element.$$('#dots')); |
| 343 }); | 359 }); |
| 344 }); | 360 }); |
| 345 }); | 361 }); |
| OLD | NEW |