mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
Use a newly mocked autofill field for password data. (#13300)
Don't reuse a global mock for this spec entitled autofillFieldData with username data modified to have a password "type". Instead create a new passwordFieldData, satisfying the conditions of a failing test caused by new inline field qualification service.
This commit is contained in:
@@ -459,15 +459,20 @@ describe("AutofillOverlayContentService", () => {
|
|||||||
const passwordFieldElement = document.getElementById(
|
const passwordFieldElement = document.getElementById(
|
||||||
"password-field",
|
"password-field",
|
||||||
) as ElementWithOpId<FormFieldElement>;
|
) as ElementWithOpId<FormFieldElement>;
|
||||||
autofillFieldData.type = "password";
|
|
||||||
|
const passwordFieldData = createAutofillFieldMock({
|
||||||
|
opid: "password-field",
|
||||||
|
form: "validFormId",
|
||||||
|
elementNumber: 2,
|
||||||
|
type: "password",
|
||||||
|
});
|
||||||
|
|
||||||
await autofillOverlayContentService.setupOverlayListeners(
|
await autofillOverlayContentService.setupOverlayListeners(
|
||||||
passwordFieldElement,
|
passwordFieldElement,
|
||||||
autofillFieldData,
|
passwordFieldData,
|
||||||
pageDetailsMock,
|
pageDetailsMock,
|
||||||
);
|
);
|
||||||
passwordFieldElement.dispatchEvent(new Event("input"));
|
passwordFieldElement.dispatchEvent(new Event("input"));
|
||||||
|
|
||||||
expect(autofillOverlayContentService["userFilledFields"].password).toEqual(
|
expect(autofillOverlayContentService["userFilledFields"].password).toEqual(
|
||||||
passwordFieldElement,
|
passwordFieldElement,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user