From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../browser_creditCard_heuristics_cc_type.js | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_heuristics_cc_type.js (limited to 'browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_heuristics_cc_type.js') diff --git a/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_heuristics_cc_type.js b/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_heuristics_cc_type.js new file mode 100644 index 0000000000..e3f12096c2 --- /dev/null +++ b/browser/extensions/formautofill/test/browser/creditCard/browser_creditCard_heuristics_cc_type.js @@ -0,0 +1,77 @@ +/* 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" }, + ], + }, + ], + }, +]); -- cgit v1.2.3