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:
parent
e8363b7e8c
commit
c7b8364a01
@ -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;
|
||||
|
@ -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,
|
||||
});
|
||||
|
||||
|
@ -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;
|
||||
|
@ -56,7 +56,7 @@ describe("AutofillOverlayButton", () => {
|
||||
autofillOverlayButton["buttonElement"].click();
|
||||
|
||||
expect(globalThis.parent.postMessage).toHaveBeenCalledWith(
|
||||
{ command: "overlayButtonClicked", portKey },
|
||||
{ command: "autofillInlineMenuButtonClicked", portKey },
|
||||
"*",
|
||||
);
|
||||
});
|
||||
|
@ -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" });
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user