Chromium Code Reviews| 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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 409 Polymer.dom.flush(); | 409 Polymer.dom.flush(); |
| 410 | 410 |
| 411 assertEquals(phoneNumber, dialog.$.phoneInput.value); | 411 assertEquals(phoneNumber, dialog.$.phoneInput.value); |
| 412 assertEquals(phoneNumber, address.phoneNumbers[0]); | 412 assertEquals(phoneNumber, address.phoneNumbers[0]); |
| 413 | 413 |
| 414 assertEquals(emailAddress, dialog.$.emailInput.value); | 414 assertEquals(emailAddress, dialog.$.emailInput.value); |
| 415 assertEquals(emailAddress, address.emailAddresses[0]); | 415 assertEquals(emailAddress, address.emailAddresses[0]); |
| 416 }); | 416 }); |
| 417 }); | 417 }); |
| 418 | 418 |
| 419 test('verifyPhoneAndEmailAreRemoved', function(done) { | |
|
michaelpg
2016/06/29 00:00:28
optional: use promises instead of done
hcarmona
2016/07/11 22:35:45
Done.
| |
| 420 var address = FakeDataMaker.emptyAddressEntry(); | |
| 421 | |
| 422 var phoneNumber = '(555) 555-5555'; | |
| 423 var emailAddress = 'no-reply@chromium.org'; | |
| 424 | |
| 425 address.phoneNumbers = [phoneNumber]; | |
| 426 address.emailAddresses = [emailAddress]; | |
| 427 | |
| 428 self.createAddressDialog_(address).then(function(dialog) { | |
|
michaelpg
2016/06/29 00:00:28
return ...
hcarmona
2016/07/11 22:35:45
Done.
| |
| 429 assertEquals(phoneNumber, dialog.$.phoneInput.value); | |
| 430 assertEquals(emailAddress, dialog.$.emailInput.value); | |
| 431 | |
| 432 dialog.$.phoneInput.value = ''; | |
| 433 dialog.$.emailInput.value = ''; | |
| 434 | |
| 435 Polymer.dom.flush(); | |
| 436 | |
| 437 assertEquals(0, address.phoneNumbers.length); | |
| 438 assertEquals(0, address.emailAddresses.length); | |
| 439 | |
| 440 done(); | |
| 441 }); | |
| 442 }); | |
| 443 | |
| 419 // Test will set a value of 'foo' in each text field and verify that the | 444 // Test will set a value of 'foo' in each text field and verify that the |
| 420 // save button is enabled, then it will clear the field and verify that the | 445 // save button is enabled, then it will clear the field and verify that the |
| 421 // save button is disabled. Test passes after all elements have been tested. | 446 // save button is disabled. Test passes after all elements have been tested. |
| 422 test('verifySaveIsNotClickableIfAllInputFieldsAreEmpty', function() { | 447 test('verifySaveIsNotClickableIfAllInputFieldsAreEmpty', function() { |
| 423 return self.createAddressDialog_( | 448 return self.createAddressDialog_( |
| 424 FakeDataMaker.emptyAddressEntry()).then(function(dialog) { | 449 FakeDataMaker.emptyAddressEntry()).then(function(dialog) { |
| 425 var saveButton = dialog.$.saveButton; | 450 var saveButton = dialog.$.saveButton; |
| 426 var testElements = | 451 var testElements = |
| 427 dialog.$.dialog.querySelectorAll('paper-input,paper-textarea'); | 452 dialog.$.dialog.querySelectorAll('paper-input,paper-textarea'); |
| 428 | 453 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 722 assertEquals(city, cols[0].value); | 747 assertEquals(city, cols[0].value); |
| 723 assertEquals(state, cols[1].value); | 748 assertEquals(state, cols[1].value); |
| 724 assertEquals(zip, cols[2].value); | 749 assertEquals(zip, cols[2].value); |
| 725 }); | 750 }); |
| 726 }); | 751 }); |
| 727 }); | 752 }); |
| 728 }); | 753 }); |
| 729 | 754 |
| 730 mocha.run(); | 755 mocha.run(); |
| 731 }); | 756 }); |
| OLD | NEW |