Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5912)

Unified Diff: chrome/test/data/webui/settings/settings_autofill_section_browsertest.js

Issue 2959023003: MD-Settings: Create tests for edit options in Credit Cards. (Closed)
Patch Set: nit Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/settings/settings_autofill_section_browsertest.js
diff --git a/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js b/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js
index 1f228594680161171de9a92ba21df959fbd53340..7f01a180d53a534455f4b4677bcd14ae0ce7fccb 100644
--- a/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js
+++ b/chrome/test/data/webui/settings/settings_autofill_section_browsertest.js
@@ -433,6 +433,89 @@ TEST_F('SettingsAutofillSectionBrowserTest', 'CreditCardTests', function() {
MockInteractions.tap(creditCardDialog.$.cancelButton);
});
});
+
+ test('verifyLocalCreditCardMenu', function() {
+ var creditCards = [FakeDataMaker.addressEntry()];
dpapad 2017/06/27 22:00:36 Shouldn't this be calling creditCardEntry()? Also
hcarmona 2017/06/27 22:26:41 Yes, good catch.
+
+ // When CC is local, |isCached| will be undefined.
+ creditCards[0].metadata.isLocal = true;
+ creditCards[0].metadata.isCached = undefined;
+
+ var section = self.createAutofillSection_([], creditCards);
+ assertTrue(!!section);
dpapad 2017/06/27 22:00:36 Is this assertion necessary? Can it ever fail?
hcarmona 2017/06/27 22:26:41 Removed here and elsewhere.
+ var creditCardList = section.$.creditCardList;
+ assertTrue(!!creditCardList);
+ assertEquals(2, creditCardList.children.length); // Template + Row.
dpapad 2017/06/27 22:00:36 How about the following? assertEquals(1, creditCar
hcarmona 2017/06/27 22:26:41 Done.
+ var row = creditCardList.children[0];
+
+ // Local CCs will show the overflow menu.
+ assertFalse(!!row.querySelector('#remoteCreditCardLink'));
+ var menuButton = row.querySelector('#creditCardMenu')
+ assertTrue(!!menuButton);
+
+ menuButton.click();
+ Polymer.dom.flush();
+
+ var ccMenu = section.$.creditCardSharedMenu;
dpapad 2017/06/27 22:00:36 Avoid non established abbreviations (per styleguid
hcarmona 2017/06/27 22:26:41 Done.
+
+ // Menu should have 2 options.
+ assertFalse(ccMenu.querySelector('#menuEditCreditCard').hidden);
+ assertFalse(ccMenu.querySelector('#menuRemoveCreditCard').hidden);
+ assertTrue(ccMenu.querySelector('#menuClearCreditCard').hidden);
+
+ ccMenu.close();
+ Polymer.dom.flush();
+ });
+
+ test('verifyCachedCreditCardMenu', function() {
+ var creditCards = [FakeDataMaker.addressEntry()];
+
+ creditCards[0].metadata.isLocal = false;
+ creditCards[0].metadata.isCached = true;
+
+ var section = self.createAutofillSection_([], creditCards);
+ assertTrue(!!section);
+ var creditCardList = section.$.creditCardList;
+ assertTrue(!!creditCardList);
+ assertEquals(2, creditCardList.children.length); // Template + Row.
+ var row = creditCardList.children[0];
+
+ // Cached remote CCs will show overflow menu.
+ assertFalse(!!row.querySelector('#remoteCreditCardLink'));
+ var menuButton = row.querySelector('#creditCardMenu')
+ assertTrue(!!menuButton);
+
+ menuButton.click();
+ Polymer.dom.flush();
+
+ var ccMenu = section.$.creditCardSharedMenu;
+
+ // Menu should have 2 options.
+ assertFalse(ccMenu.querySelector('#menuEditCreditCard').hidden);
+ assertTrue(ccMenu.querySelector('#menuRemoveCreditCard').hidden);
+ assertFalse(ccMenu.querySelector('#menuClearCreditCard').hidden);
+
+ ccMenu.close();
+ Polymer.dom.flush();
+ });
+
+ test('verifyNotCachedCreditCardMenu', function() {
+ var creditCards = [FakeDataMaker.addressEntry()];
+
+ creditCards[0].metadata.isLocal = false;
+ creditCards[0].metadata.isCached = false;
+
+ var section = self.createAutofillSection_([], creditCards);
+ assertTrue(!!section);
+ var creditCardList = section.$.creditCardList;
+ assertTrue(!!creditCardList);
+ assertEquals(2, creditCardList.children.length); // Template + Row.
+ var row = creditCardList.children[0];
+
+ // No overflow menu when not cached.
+ assertTrue(!!row.querySelector('#remoteCreditCardLink'));
+ assertFalse(!!row.querySelector('#creditCardMenu'));
+ });
});
mocha.run();
« no previous file with comments | « chrome/browser/resources/settings/passwords_and_forms_page/autofill_section.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698