1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-16 16:23:44 +00:00

[PM-8027] Adding jest test to validate new behavior

This commit is contained in:
Cesar Gonzalez
2024-06-03 16:25:20 -05:00
parent 2c1dfc9261
commit 6b7b6cb303

View File

@@ -248,11 +248,16 @@ describe("CollectAutofillContentService", () => {
const isFormFieldViewableSpy = jest const isFormFieldViewableSpy = jest
.spyOn(collectAutofillContentService["domElementVisibilityService"], "isFormFieldViewable") .spyOn(collectAutofillContentService["domElementVisibilityService"], "isFormFieldViewable")
.mockResolvedValue(true); .mockResolvedValue(true);
const setupAutofillOverlayListenerOnFieldSpy = jest.spyOn(
collectAutofillContentService["autofillOverlayContentService"],
"setupAutofillOverlayListenerOnField",
);
await collectAutofillContentService.getPageDetails(); await collectAutofillContentService.getPageDetails();
expect(autofillField.viewable).toBe(true); expect(autofillField.viewable).toBe(true);
expect(isFormFieldViewableSpy).toHaveBeenCalledWith(fieldElement); expect(isFormFieldViewableSpy).toHaveBeenCalledWith(fieldElement);
expect(setupAutofillOverlayListenerOnFieldSpy).toHaveBeenCalled();
}); });
it("returns an object containing information about the current page as well as autofill data for the forms and fields of the page", async () => { it("returns an object containing information about the current page as well as autofill data for the forms and fields of the page", async () => {