1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-26 22:01:32 +01:00

[PM-5189] Refactoring implementation

This commit is contained in:
Cesar Gonzalez 2024-05-03 02:45:07 -05:00
parent e8363b7e8c
commit c7b8364a01
No known key found for this signature in database
GPG Key ID: 3381A5457F8CCECF
5 changed files with 7 additions and 7 deletions

View File

@ -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;

View File

@ -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,
});

View File

@ -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;

View File

@ -56,7 +56,7 @@ describe("AutofillOverlayButton", () => {
autofillOverlayButton["buttonElement"].click();
expect(globalThis.parent.postMessage).toHaveBeenCalledWith(
{ command: "overlayButtonClicked", portKey },
{ command: "autofillInlineMenuButtonClicked", portKey },
"*",
);
});

View File

@ -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" });
};
/**