From 7deba63589bf8dafd86b578abf316d736d2af71a Mon Sep 17 00:00:00 2001 From: Jonathan Prusik Date: Mon, 30 Dec 2024 09:17:57 -0500 Subject: [PATCH] handle expiry field placeholder values with capitalized values (#12559) --- apps/browser/src/autofill/services/autofill.service.spec.ts | 5 ++++- apps/browser/src/autofill/services/autofill.service.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/browser/src/autofill/services/autofill.service.spec.ts b/apps/browser/src/autofill/services/autofill.service.spec.ts index 812891930b8..91f926440a0 100644 --- a/apps/browser/src/autofill/services/autofill.service.spec.ts +++ b/apps/browser/src/autofill/services/autofill.service.spec.ts @@ -2937,7 +2937,9 @@ describe("AutofillService", () => { const expectedDateFormats = [ ["mm/yyyy", "05/2024"], + ["mm/YYYY", "05/2024"], ["mm/yy", "05/24"], + ["MM/YY", "05/24"], ["yyyy/mm", "2024/05"], ["yy/mm", "24/05"], ["mm-yyyy", "05-2024"], @@ -2946,6 +2948,7 @@ describe("AutofillService", () => { ["yy-mm", "24-05"], ["yyyymm", "202405"], ["yymm", "2405"], + ["YYMM", "2405"], ["mmyyyy", "052024"], ["mmyy", "0524"], ]; @@ -3875,7 +3878,7 @@ describe("AutofillService", () => { }); describe("given a autofill field value that indicates the field is a `select` input", () => { - it("will not add an autofil action to the fill script if the dataValue cannot be found in the select options", () => { + it("will not add an autofill action to the fill script if the dataValue cannot be found in the select options", () => { const dataValue = "username"; const selectField = createAutofillFieldMock({ opid: "username-field", diff --git a/apps/browser/src/autofill/services/autofill.service.ts b/apps/browser/src/autofill/services/autofill.service.ts index d6524f7e70d..093f4bfb638 100644 --- a/apps/browser/src/autofill/services/autofill.service.ts +++ b/apps/browser/src/autofill/services/autofill.service.ts @@ -1514,7 +1514,7 @@ export default class AutofillService implements AutofillServiceInterface { ); return CreditCardAutoFillConstants.CardAttributesExtended.find((attributeName) => { - const fieldAttributeValue = field[attributeName]; + const fieldAttributeValue = field[attributeName]?.toLocaleLowerCase(); const fieldAttributeMatch = fieldAttributeValue?.match(dateFormatPattern); // break find as soon as a match is found