diff --git a/apps/browser/src/autofill/background/abstractions/overlay.background.ts b/apps/browser/src/autofill/background/abstractions/overlay.background.ts index a0c224972d2..addb020404d 100644 --- a/apps/browser/src/autofill/background/abstractions/overlay.background.ts +++ b/apps/browser/src/autofill/background/abstractions/overlay.background.ts @@ -96,7 +96,7 @@ type OverlayBackgroundExtensionMessageHandlers = { closeAutofillOverlayMenu: ({ message, sender }: BackgroundOnMessageHandlerParams) => void; autofillOverlayElementClosed: ({ message }: BackgroundMessageParam) => void; autofillOverlayAddNewVaultItem: ({ message, sender }: BackgroundOnMessageHandlerParams) => void; - getAutofillOverlayVisibility: () => void; + getInlineMenuVisibilitySetting: () => void; checkAutofillOverlayMenuFocused: () => void; focusAutofillOverlayList: () => void; updateAutofillOverlayMenuPosition: ({ diff --git a/apps/browser/src/autofill/background/overlay.background.spec.ts b/apps/browser/src/autofill/background/overlay.background.spec.ts index 2e4bd724223..af7755a8903 100644 --- a/apps/browser/src/autofill/background/overlay.background.spec.ts +++ b/apps/browser/src/autofill/background/overlay.background.spec.ts @@ -133,7 +133,7 @@ describe("OverlayBackground", () => { ); jest - .spyOn(overlayBackground as any, "getOverlayVisibility") + .spyOn(overlayBackground as any, "getInlineMenuVisibility") .mockResolvedValue(AutofillOverlayVisibility.OnFieldFocus); themeStateService.selectedTheme$ = of(ThemeType.Light); @@ -161,13 +161,13 @@ describe("OverlayBackground", () => { describe("init", () => { it("sets up the extension message listeners, get the overlay's visibility settings, and get the user's auth status", async () => { overlayBackground["setupExtensionMessageListeners"] = jest.fn(); - overlayBackground["getOverlayVisibility"] = jest.fn(); + overlayBackground["getInlineMenuVisibility"] = jest.fn(); overlayBackground["getAuthStatus"] = jest.fn(); await overlayBackground.init(); expect(overlayBackground["setupExtensionMessageListeners"]).toHaveBeenCalled(); - expect(overlayBackground["getOverlayVisibility"]).toHaveBeenCalled(); + expect(overlayBackground["getInlineMenuVisibility"]).toHaveBeenCalled(); expect(overlayBackground["getAuthStatus"]).toHaveBeenCalled(); }); }); @@ -638,18 +638,18 @@ describe("OverlayBackground", () => { }); }); - describe("getAutofillOverlayVisibility message handler", () => { + describe("getInlineMenuVisibilitySetting message handler", () => { beforeEach(() => { jest - .spyOn(overlayBackground as any, "getOverlayVisibility") + .spyOn(overlayBackground as any, "getInlineMenuVisibility") .mockResolvedValue(AutofillOverlayVisibility.OnFieldFocus); }); it("will set the overlayVisibility property", async () => { - sendMockExtensionMessage({ command: "getAutofillOverlayVisibility" }); + sendMockExtensionMessage({ command: "getInlineMenuVisibilitySetting" }); await flushPromises(); - expect(await overlayBackground["getOverlayVisibility"]()).toBe( + expect(await overlayBackground["getInlineMenuVisibility"]()).toBe( AutofillOverlayVisibility.OnFieldFocus, ); }); @@ -658,7 +658,7 @@ describe("OverlayBackground", () => { const sendMessageSpy = jest.fn(); sendMockExtensionMessage( - { command: "getAutofillOverlayVisibility" }, + { command: "getInlineMenuVisibilitySetting" }, undefined, sendMessageSpy, ); diff --git a/apps/browser/src/autofill/background/overlay.background.ts b/apps/browser/src/autofill/background/overlay.background.ts index 274de48243a..24433a3adf5 100644 --- a/apps/browser/src/autofill/background/overlay.background.ts +++ b/apps/browser/src/autofill/background/overlay.background.ts @@ -68,7 +68,7 @@ class OverlayBackground implements OverlayBackgroundInterface { closeAutofillOverlayMenu: ({ message, sender }) => this.closeOverlayMenu(sender, message), autofillOverlayElementClosed: ({ message }) => this.overlayElementClosed(message), autofillOverlayAddNewVaultItem: ({ message, sender }) => this.addNewVaultItem(message, sender), - getAutofillOverlayVisibility: () => this.getOverlayVisibility(), + getInlineMenuVisibilitySetting: () => this.getInlineMenuVisibility(), checkAutofillOverlayMenuFocused: () => this.checkOverlayMenuFocused(), focusAutofillOverlayList: () => this.focusOverlayList(), updateAutofillOverlayMenuPosition: ({ message, sender }) => @@ -135,7 +135,7 @@ class OverlayBackground implements OverlayBackgroundInterface { this.setupExtensionMessageListeners(); const env = await firstValueFrom(this.environmentService.environment$); this.iconsServerUrl = env.getIconsUrl(); - await this.getOverlayVisibility(); + await this.getInlineMenuVisibility(); await this.getAuthStatus(); } @@ -641,7 +641,7 @@ class OverlayBackground implements OverlayBackgroundInterface { /** * Gets the overlay's visibility setting from the settings service. */ - private async getOverlayVisibility(): Promise { + private async getInlineMenuVisibility(): Promise { return await firstValueFrom(this.autofillSettingsService.inlineMenuVisibility$); } 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 f1d3cdf2194..f2da96d0284 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 @@ -230,7 +230,7 @@ describe("AutofillOverlayContentService", () => { autofillFieldData, ); - expect(sendExtensionMessageSpy).toHaveBeenCalledWith("getAutofillOverlayVisibility"); + expect(sendExtensionMessageSpy).toHaveBeenCalledWith("getInlineMenuVisibilitySetting"); expect(autofillOverlayContentService["autofillOverlayVisibility"]).toEqual( AutofillOverlayVisibility.OnFieldFocus, ); diff --git a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts index 95f16f41f65..8f27959b2bf 100644 --- a/apps/browser/src/autofill/services/autofill-overlay-content.service.ts +++ b/apps/browser/src/autofill/services/autofill-overlay-content.service.ts @@ -93,7 +93,7 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte } if (!this.autofillOverlayVisibility) { - await this.getAutofillOverlayVisibility(); + await this.getInlineMenuVisibilitySetting(); } this.setupFormFieldElementEventListeners(formFieldElement); @@ -722,8 +722,8 @@ class AutofillOverlayContentService implements AutofillOverlayContentServiceInte * If the setting is not found, a default value of OnFieldFocus will be used * @private */ - private async getAutofillOverlayVisibility() { - const overlayVisibility = await this.sendExtensionMessage("getAutofillOverlayVisibility"); + private async getInlineMenuVisibilitySetting() { + const overlayVisibility = await this.sendExtensionMessage("getInlineMenuVisibilitySetting"); this.autofillOverlayVisibility = overlayVisibility || AutofillOverlayVisibility.OnFieldFocus; } diff --git a/apps/browser/src/autofill/services/autofill.service.spec.ts b/apps/browser/src/autofill/services/autofill.service.spec.ts index 9618beccba3..66cc4ac4d2c 100644 --- a/apps/browser/src/autofill/services/autofill.service.spec.ts +++ b/apps/browser/src/autofill/services/autofill.service.spec.ts @@ -108,7 +108,7 @@ describe("AutofillService", () => { .spyOn(BrowserApi, "getAllFrames") .mockResolvedValue([mock({ frameId: 0 })]); jest - .spyOn(autofillService, "getOverlayVisibility") + .spyOn(autofillService, "getInlineMenuVisibility") .mockResolvedValue(AutofillOverlayVisibility.OnFieldFocus); jest.spyOn(autofillService, "getAutofillOnPageLoad").mockResolvedValue(true); }); @@ -186,7 +186,7 @@ describe("AutofillService", () => { sender = { tab: tabMock, frameId: 1 }; jest.spyOn(BrowserApi, "executeScriptInTab").mockImplementation(); jest - .spyOn(autofillService, "getOverlayVisibility") + .spyOn(autofillService, "getInlineMenuVisibility") .mockResolvedValue(AutofillOverlayVisibility.OnFieldFocus); jest.spyOn(autofillService, "getAutofillOnPageLoad").mockResolvedValue(true); }); @@ -232,7 +232,7 @@ describe("AutofillService", () => { it("will inject the bootstrap-autofill script if the user does not have the autofill overlay enabled", async () => { jest - .spyOn(autofillService, "getOverlayVisibility") + .spyOn(autofillService, "getInlineMenuVisibility") .mockResolvedValue(AutofillOverlayVisibility.Off); await autofillService.injectAutofillScripts(sender.tab, sender.frameId); diff --git a/apps/browser/src/autofill/services/autofill.service.ts b/apps/browser/src/autofill/services/autofill.service.ts index 654e08b4aa4..b06d4c85742 100644 --- a/apps/browser/src/autofill/services/autofill.service.ts +++ b/apps/browser/src/autofill/services/autofill.service.ts @@ -99,7 +99,7 @@ export default class AutofillService implements AutofillServiceInterface { frameId = 0, triggeringOnPageLoad = true, ): Promise { - const mainAutofillScript = (await this.getOverlayVisibility()) + const mainAutofillScript = (await this.getInlineMenuVisibility()) ? "bootstrap-autofill-overlay.js" : "bootstrap-autofill.js"; @@ -199,7 +199,7 @@ export default class AutofillService implements AutofillServiceInterface { /** * Gets the overlay's visibility setting from the autofill settings service. */ - async getOverlayVisibility(): Promise { + async getInlineMenuVisibility(): Promise { return await firstValueFrom(this.autofillSettingsService.inlineMenuVisibility$); }