diff --git a/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts b/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts index df985a6595e..96a1b4c8512 100644 --- a/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts +++ b/apps/browser/src/autofill/services/autofill-overlay-content.service.spec.ts @@ -971,6 +971,14 @@ describe("AutofillOverlayContentService", () => { expect(document.body.contains(overlayButtonElement)).toEqual(false); }); + it("sends a message to the background indicating that the overlay button has been closed", () => { + autofillOverlayContentService.removeAutofillOverlay(); + + expect(sendExtensionMessageSpy).toHaveBeenCalledWith("autofillOverlayElementClosed", { + overlayElement: AutofillOverlayElement.Button, + }); + }); + it("removes the overlay reposition event listeners", () => { jest.spyOn(globalThis.document.body, "removeEventListener"); jest.spyOn(globalThis, "removeEventListener"); @@ -1012,6 +1020,14 @@ describe("AutofillOverlayContentService", () => { expect(autofillOverlayContentService["isOverlayListVisible"]).toEqual(false); expect(document.body.contains(overlayListElement)).toEqual(false); }); + + it("sends a message to the extension background indicating that the overlay list has closed", () => { + autofillOverlayContentService.removeAutofillOverlay(); + + expect(sendExtensionMessageSpy).toHaveBeenCalledWith("autofillOverlayElementClosed", { + overlayElement: AutofillOverlayElement.List, + }); + }); }); describe("addNewVaultItem", () => {