From c7b8364a0194f3541cf4ce2d667e57930af44b16 Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Fri, 3 May 2024 02:45:07 -0500 Subject: [PATCH] [PM-5189] Refactoring implementation --- .../autofill/background/abstractions/overlay.background.ts | 2 +- .../src/autofill/background/overlay.background.spec.ts | 4 ++-- apps/browser/src/autofill/background/overlay.background.ts | 4 ++-- .../overlay/pages/button/autofill-overlay-button.spec.ts | 2 +- .../autofill/overlay/pages/button/autofill-overlay-button.ts | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/browser/src/autofill/background/abstractions/overlay.background.ts b/apps/browser/src/autofill/background/abstractions/overlay.background.ts index 4d2533f6b0..f4877a6188 100644 --- a/apps/browser/src/autofill/background/abstractions/overlay.background.ts +++ b/apps/browser/src/autofill/background/abstractions/overlay.background.ts @@ -130,7 +130,7 @@ type PortOnMessageHandlerParams = PortMessageParam & PortConnectionParam; type OverlayButtonPortMessageHandlers = { [key: string]: CallableFunction; - overlayButtonClicked: ({ port }: PortConnectionParam) => void; + autofillInlineMenuButtonClicked: ({ port }: PortConnectionParam) => void; closeAutofillInlineMenu: ({ port }: PortConnectionParam) => void; forceCloseAutofillOverlay: ({ port }: PortConnectionParam) => void; overlayPageBlurred: () => void; diff --git a/apps/browser/src/autofill/background/overlay.background.spec.ts b/apps/browser/src/autofill/background/overlay.background.spec.ts index 732322b541..d4785444b2 100644 --- a/apps/browser/src/autofill/background/overlay.background.spec.ts +++ b/apps/browser/src/autofill/background/overlay.background.spec.ts @@ -1142,7 +1142,7 @@ describe("OverlayBackground", () => { jest.spyOn(overlayBackground as any, "unlockVault").mockImplementation(); sendPortMessage(buttonMessageConnectorPortSpy, { - command: "overlayButtonClicked", + command: "autofillInlineMenuButtonClicked", portKey, }); @@ -1153,7 +1153,7 @@ describe("OverlayBackground", () => { jest.spyOn(overlayBackground as any, "openInlineMenu").mockImplementation(); sendPortMessage(buttonMessageConnectorPortSpy, { - command: "overlayButtonClicked", + command: "autofillInlineMenuButtonClicked", portKey, }); diff --git a/apps/browser/src/autofill/background/overlay.background.ts b/apps/browser/src/autofill/background/overlay.background.ts index 7ec8346658..7f32245be3 100644 --- a/apps/browser/src/autofill/background/overlay.background.ts +++ b/apps/browser/src/autofill/background/overlay.background.ts @@ -94,7 +94,7 @@ class OverlayBackground implements OverlayBackgroundInterface { deletedCipher: () => this.updateOverlayCiphers(), }; private readonly overlayButtonPortMessageHandlers: OverlayButtonPortMessageHandlers = { - overlayButtonClicked: ({ port }) => this.handleOverlayButtonClicked(port), + autofillInlineMenuButtonClicked: ({ port }) => this.handleInlineMenuButtonClicked(port), closeAutofillInlineMenu: ({ port }) => this.closeInlineMenu(port.sender), forceCloseAutofillOverlay: ({ port }) => this.closeInlineMenu(port.sender, { forceCloseAutofillInlineMenu: true }), @@ -686,7 +686,7 @@ class OverlayBackground implements OverlayBackgroundInterface { * * @param port - The port of the overlay button */ - private handleOverlayButtonClicked(port: chrome.runtime.Port) { + private handleInlineMenuButtonClicked(port: chrome.runtime.Port) { if (this.userAuthStatus !== AuthenticationStatus.Unlocked) { void this.unlockVault(port); return; diff --git a/apps/browser/src/autofill/overlay/pages/button/autofill-overlay-button.spec.ts b/apps/browser/src/autofill/overlay/pages/button/autofill-overlay-button.spec.ts index 6ae356ac61..0aec77b48e 100644 --- a/apps/browser/src/autofill/overlay/pages/button/autofill-overlay-button.spec.ts +++ b/apps/browser/src/autofill/overlay/pages/button/autofill-overlay-button.spec.ts @@ -56,7 +56,7 @@ describe("AutofillOverlayButton", () => { autofillOverlayButton["buttonElement"].click(); expect(globalThis.parent.postMessage).toHaveBeenCalledWith( - { command: "overlayButtonClicked", portKey }, + { command: "autofillInlineMenuButtonClicked", portKey }, "*", ); }); diff --git a/apps/browser/src/autofill/overlay/pages/button/autofill-overlay-button.ts b/apps/browser/src/autofill/overlay/pages/button/autofill-overlay-button.ts index 3022617255..6bc4f0c42b 100644 --- a/apps/browser/src/autofill/overlay/pages/button/autofill-overlay-button.ts +++ b/apps/browser/src/autofill/overlay/pages/button/autofill-overlay-button.ts @@ -103,7 +103,7 @@ class AutofillOverlayButton extends AutofillOverlayPageElement { * parent window indicating that the button was clicked. */ private handleButtonElementClick = () => { - this.postMessageToParent({ command: "overlayButtonClicked" }); + this.postMessageToParent({ command: "autofillInlineMenuButtonClicked" }); }; /**