From 49a1dc43765c8f1fd9edb924510eff5a110341f4 Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Tue, 1 Oct 2024 16:08:40 -0500 Subject: [PATCH] [PM-8833] Implementing jest tests for OverlayBackground --- .../background/overlay.background.spec.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/apps/browser/src/autofill/background/overlay.background.spec.ts b/apps/browser/src/autofill/background/overlay.background.spec.ts index e41606139feb..77fb9a226076 100644 --- a/apps/browser/src/autofill/background/overlay.background.spec.ts +++ b/apps/browser/src/autofill/background/overlay.background.spec.ts @@ -68,6 +68,7 @@ import { import { FocusedFieldData, + InlineMenuPosition, PageDetailsForTab, SubFrameOffsetData, SubFrameOffsetsForTab, @@ -2394,6 +2395,22 @@ describe("OverlayBackground", () => { }); }); + describe("getAutofillInlineMenuPosition", () => { + it("returns the current inline menu positio", async () => { + const inlineMenuPosition: InlineMenuPosition = mock(); + overlayBackground["inlineMenuPosition"] = inlineMenuPosition; + + sendMockExtensionMessage( + { command: "getAutofillInlineMenuPosition" }, + mock(), + sendResponse, + ); + await flushPromises(); + + expect(sendResponse).toHaveBeenCalledWith(inlineMenuPosition); + }); + }); + describe("updateAutofillInlineMenuElementIsVisibleStatus message handler", () => { let sender: chrome.runtime.MessageSender; let focusedFieldData: FocusedFieldData;