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 Runs the Polymer Autofill Settings tests. */ | 5 /** @fileoverview Runs the Polymer Autofill Settings tests. */ |
6 | 6 |
7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */ | 7 /** @const {string} Path to root from chrome/test/data/webui/settings/. */ |
8 var ROOT_PATH = '../../../../../'; | 8 var ROOT_PATH = '../../../../../'; |
9 | 9 |
10 // Polymer BrowserTest fixture. | 10 // Polymer BrowserTest fixture. |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 Polymer.dom.flush(); | 421 Polymer.dom.flush(); |
422 | 422 |
423 assertEquals(phoneNumber, dialog.$.phoneInput.value); | 423 assertEquals(phoneNumber, dialog.$.phoneInput.value); |
424 assertEquals(phoneNumber, address.phoneNumbers[0]); | 424 assertEquals(phoneNumber, address.phoneNumbers[0]); |
425 | 425 |
426 assertEquals(emailAddress, dialog.$.emailInput.value); | 426 assertEquals(emailAddress, dialog.$.emailInput.value); |
427 assertEquals(emailAddress, address.emailAddresses[0]); | 427 assertEquals(emailAddress, address.emailAddresses[0]); |
428 }); | 428 }); |
429 }); | 429 }); |
430 | 430 |
| 431 test('verifyPhoneAndEmailAreRemoved', function() { |
| 432 var address = FakeDataMaker.emptyAddressEntry(); |
| 433 |
| 434 var phoneNumber = '(555) 555-5555'; |
| 435 var emailAddress = 'no-reply@chromium.org'; |
| 436 |
| 437 address.phoneNumbers = [phoneNumber]; |
| 438 address.emailAddresses = [emailAddress]; |
| 439 |
| 440 return self.createAddressDialog_(address).then(function(dialog) { |
| 441 assertEquals(phoneNumber, dialog.$.phoneInput.value); |
| 442 assertEquals(emailAddress, dialog.$.emailInput.value); |
| 443 |
| 444 dialog.$.phoneInput.value = ''; |
| 445 dialog.$.emailInput.value = ''; |
| 446 |
| 447 Polymer.dom.flush(); |
| 448 |
| 449 assertEquals(0, address.phoneNumbers.length); |
| 450 assertEquals(0, address.emailAddresses.length); |
| 451 }); |
| 452 }); |
| 453 |
431 // Test will set a value of 'foo' in each text field and verify that the | 454 // Test will set a value of 'foo' in each text field and verify that the |
432 // save button is enabled, then it will clear the field and verify that the | 455 // save button is enabled, then it will clear the field and verify that the |
433 // save button is disabled. Test passes after all elements have been tested. | 456 // save button is disabled. Test passes after all elements have been tested. |
434 test('verifySaveIsNotClickableIfAllInputFieldsAreEmpty', function() { | 457 test('verifySaveIsNotClickableIfAllInputFieldsAreEmpty', function() { |
435 return self.createAddressDialog_( | 458 return self.createAddressDialog_( |
436 FakeDataMaker.emptyAddressEntry()).then(function(dialog) { | 459 FakeDataMaker.emptyAddressEntry()).then(function(dialog) { |
437 var saveButton = dialog.$.saveButton; | 460 var saveButton = dialog.$.saveButton; |
438 var testElements = | 461 var testElements = |
439 dialog.$.dialog.querySelectorAll('paper-input,paper-textarea'); | 462 dialog.$.dialog.querySelectorAll('paper-input,paper-textarea'); |
440 | 463 |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 assertEquals(city, cols[0].value); | 765 assertEquals(city, cols[0].value); |
743 assertEquals(state, cols[1].value); | 766 assertEquals(state, cols[1].value); |
744 assertEquals(zip, cols[2].value); | 767 assertEquals(zip, cols[2].value); |
745 }); | 768 }); |
746 }); | 769 }); |
747 }); | 770 }); |
748 }); | 771 }); |
749 | 772 |
750 mocha.run(); | 773 mocha.run(); |
751 }); | 774 }); |
OLD | NEW |