| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 var creditCardList = section.$.creditCardList; | 210 var creditCardList = section.$.creditCardList; |
| 211 var row = creditCardList.children[0]; | 211 var row = creditCardList.children[0]; |
| 212 assertTrue(!!row); | 212 assertTrue(!!row); |
| 213 | 213 |
| 214 assertEquals(creditCard.metadata.summaryLabel, | 214 assertEquals(creditCard.metadata.summaryLabel, |
| 215 row.querySelector('#creditCardLabel').textContent); | 215 row.querySelector('#creditCardLabel').textContent); |
| 216 assertEquals(creditCard.expirationMonth + '/' + creditCard.expirationYear, | 216 assertEquals(creditCard.expirationMonth + '/' + creditCard.expirationYear, |
| 217 row.querySelector('#creditCardExpiration').textContent); | 217 row.querySelector('#creditCardExpiration').textContent); |
| 218 }); | 218 }); |
| 219 | 219 |
| 220 test('verifyCreditCardRowButtonIsDropdownWhenLocal', function() { |
| 221 var creditCard = FakeDataMaker.creditCardEntry(); |
| 222 creditCard.metadata.isLocal = true; |
| 223 var section = self.createAutofillSection_([], [creditCard]); |
| 224 var creditCardList = section.$.creditCardList; |
| 225 var row = creditCardList.children[0]; |
| 226 assertTrue(!!row); |
| 227 var menuButton = row.querySelector('#creditCardMenu'); |
| 228 assertTrue(!!menuButton); |
| 229 var outlinkButton = row.querySelector('[is="paper-icon-button-light"'); |
| 230 assertFalse(!!outlinkButton); |
| 231 }); |
| 232 |
| 233 test('verifyCreditCardRowButtonIsOutlinkWhenRemote', function() { |
| 234 var creditCard = FakeDataMaker.creditCardEntry(); |
| 235 creditCard.metadata.isLocal = false; |
| 236 var section = self.createAutofillSection_([], [creditCard]); |
| 237 var creditCardList = section.$.creditCardList; |
| 238 var row = creditCardList.children[0]; |
| 239 assertTrue(!!row); |
| 240 var menuButton = row.querySelector('#creditCardMenu'); |
| 241 assertFalse(!!menuButton); |
| 242 var outlinkButton = row.querySelector('[is="paper-icon-button-light"'); |
| 243 assertTrue(!!outlinkButton); |
| 244 }); |
| 245 |
| 220 test('verifyAddVsEditCreditCardTitle', function() { | 246 test('verifyAddVsEditCreditCardTitle', function() { |
| 221 var newCreditCard = FakeDataMaker.emptyCreditCardEntry(); | 247 var newCreditCard = FakeDataMaker.emptyCreditCardEntry(); |
| 222 var newCreditCardDialog = self.createCreditCardDialog_(newCreditCard); | 248 var newCreditCardDialog = self.createCreditCardDialog_(newCreditCard); |
| 223 var oldCreditCard = FakeDataMaker.creditCardEntry(); | 249 var oldCreditCard = FakeDataMaker.creditCardEntry(); |
| 224 var oldCreditCardDialog = self.createCreditCardDialog_(oldCreditCard); | 250 var oldCreditCardDialog = self.createCreditCardDialog_(oldCreditCard); |
| 225 | 251 |
| 226 assertNotEquals(oldCreditCardDialog.title_, newCreditCardDialog.title_); | 252 assertNotEquals(oldCreditCardDialog.title_, newCreditCardDialog.title_); |
| 227 assertNotEquals('', newCreditCardDialog.title_); | 253 assertNotEquals('', newCreditCardDialog.title_); |
| 228 assertNotEquals('', oldCreditCardDialog.title_); | 254 assertNotEquals('', oldCreditCardDialog.title_); |
| 229 }); | 255 }); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 | 449 |
| 424 // Eliminate white space between nodes! | 450 // Eliminate white space between nodes! |
| 425 var addressPieces = row.querySelector('#addressSummary').children; | 451 var addressPieces = row.querySelector('#addressSummary').children; |
| 426 for (var i = 0; i < addressPieces.length; ++i) { | 452 for (var i = 0; i < addressPieces.length; ++i) { |
| 427 actualSummary += addressPieces[i].textContent.trim(); | 453 actualSummary += addressPieces[i].textContent.trim(); |
| 428 } | 454 } |
| 429 | 455 |
| 430 assertEquals(addressSummary, actualSummary); | 456 assertEquals(addressSummary, actualSummary); |
| 431 }); | 457 }); |
| 432 | 458 |
| 459 test('verifyAddressRowButtonIsDropdownWhenLocal', function() { |
| 460 var address = FakeDataMaker.addressEntry(); |
| 461 address.metadata.isLocal = true; |
| 462 var section = self.createAutofillSection_([address], []); |
| 463 var addressList = section.$.addressList; |
| 464 var row = addressList.children[0]; |
| 465 assertTrue(!!row); |
| 466 var menuButton = row.querySelector('#addressMenu') |
| 467 assertTrue(!!menuButton); |
| 468 var outlinkButton = row.querySelector('[is="paper-icon-button-light"]'); |
| 469 assertFalse(!!outlinkButton); |
| 470 }); |
| 471 |
| 472 test('verifyAddressRowButtonIsOutlinkWhenRemote', function() { |
| 473 var address = FakeDataMaker.addressEntry(); |
| 474 address.metadata.isLocal = false; |
| 475 var section = self.createAutofillSection_([address], []); |
| 476 var addressList = section.$.addressList; |
| 477 var row = addressList.children[0]; |
| 478 assertTrue(!!row); |
| 479 var menuButton = row.querySelector('#addressMenu') |
| 480 assertFalse(!!menuButton); |
| 481 var outlinkButton = row.querySelector('[is="paper-icon-button-light"]'); |
| 482 assertTrue(!!outlinkButton); |
| 483 }); |
| 484 |
| 433 test('verifyAddAddressDialog', function() { | 485 test('verifyAddAddressDialog', function() { |
| 434 return self.createAddressDialog_( | 486 return self.createAddressDialog_( |
| 435 FakeDataMaker.emptyAddressEntry()).then(function(dialog) { | 487 FakeDataMaker.emptyAddressEntry()).then(function(dialog) { |
| 436 var title = dialog.$$('.title'); | 488 var title = dialog.$$('.title'); |
| 437 assertEquals(loadTimeData.getString('addAddressTitle'), | 489 assertEquals(loadTimeData.getString('addAddressTitle'), |
| 438 title.textContent); | 490 title.textContent); |
| 439 // Shouldn't be possible to save until something is typed in. | 491 // Shouldn't be possible to save until something is typed in. |
| 440 assertTrue(dialog.$.saveButton.disabled); | 492 assertTrue(dialog.$.saveButton.disabled); |
| 441 }); | 493 }); |
| 442 }); | 494 }); |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 assertEquals(city, cols[0].value); | 896 assertEquals(city, cols[0].value); |
| 845 assertEquals(state, cols[1].value); | 897 assertEquals(state, cols[1].value); |
| 846 assertEquals(zip, cols[2].value); | 898 assertEquals(zip, cols[2].value); |
| 847 }); | 899 }); |
| 848 }); | 900 }); |
| 849 }); | 901 }); |
| 850 }); | 902 }); |
| 851 | 903 |
| 852 mocha.run(); | 904 mocha.run(); |
| 853 }); | 905 }); |
| OLD | NEW |