/* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ "use strict"; const TEST_PROFILE = { "cc-name": "John Doe", "cc-number": "4111111111111111", // "cc-type" should be remove from proile after fixing Bug 1834768. "cc-type": "visa", "cc-exp-month": 4, "cc-exp-year": new Date().getFullYear(), }; add_setup(async function () { await SpecialPowers.pushPrefEnv({ set: [ ["extensions.formautofill.creditCards.supported", "on"], ["extensions.formautofill.creditCards.enabled", true], ], }); }); add_autofill_heuristic_tests([ { description: "cc-type select does not have any information in labels or attributes", fixtureData: `
`, profile: TEST_PROFILE, expectedResult: [ { description: "cc-type option.value has the hint", default: { reason: "autocomplete", }, fields: [ { fieldName: "cc-number", autofill: TEST_PROFILE["cc-number"] }, { fieldName: "cc-name", autofill: TEST_PROFILE["cc-name"] }, { fieldName: "cc-type", reason: "regex-heuristic", autofill: "VISA" }, ], }, { description: "cc-type option.text has the hint", default: { reason: "autocomplete", }, fields: [ { fieldName: "cc-number", autofill: TEST_PROFILE["cc-number"] }, { fieldName: "cc-name", autofill: TEST_PROFILE["cc-name"] }, { fieldName: "cc-type", reason: "regex-heuristic", autofill: "1" }, ], }, ], }, ]);