From 9a3681c99bf7877bef5320644a5752c3dd5fe5e7 Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Thu, 13 Jun 2024 14:19:34 -0500 Subject: [PATCH] [PM-8027] Fixing an issue where a field that has no form and no visible password fields should be qualified if a single password field exists in the page --- ...e-menu-field-qualification.service.spec.ts | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/apps/browser/src/autofill/services/inline-menu-field-qualification.service.spec.ts b/apps/browser/src/autofill/services/inline-menu-field-qualification.service.spec.ts index c0f765e7393..dd76a24e411 100644 --- a/apps/browser/src/autofill/services/inline-menu-field-qualification.service.spec.ts +++ b/apps/browser/src/autofill/services/inline-menu-field-qualification.service.spec.ts @@ -536,7 +536,7 @@ describe("InlineMenuFieldQualificationService", () => { pageDetails.forms = {}; }); - it("is structured on a page with a single password field", () => { + it("is structured on a page with a single visible password field", () => { const field = mock({ type: "text", autoCompleteType: "off", @@ -558,6 +558,29 @@ describe("InlineMenuFieldQualificationService", () => { ).toBe(true); }); + it("is structured on a page with a single non-visible password field", () => { + const field = mock({ + type: "text", + autoCompleteType: "off", + htmlID: "user-username", + htmlName: "user-username", + placeholder: "user-username", + }); + const passwordField = mock({ + type: "password", + autoCompleteType: "current-password", + htmlID: "user-password", + htmlName: "user-password", + placeholder: "user-password", + viewable: false, + }); + pageDetails.fields = [field, passwordField]; + + expect( + inlineMenuFieldQualificationService.isFieldForLoginForm(field, pageDetails), + ).toBe(true); + }); + it("has a non-disabled autoCompleteType and is structured on a page with no other password fields", () => { const field = mock({ type: "text",