mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
[PM-5189] Implementing jest tests for the OverlayBackground
This commit is contained in:
@@ -137,7 +137,7 @@ export type PortOnMessageHandlerParams = PortMessageParam & PortConnectionParam;
|
|||||||
export type InlineMenuButtonPortMessageHandlers = {
|
export type InlineMenuButtonPortMessageHandlers = {
|
||||||
[key: string]: CallableFunction;
|
[key: string]: CallableFunction;
|
||||||
autofillInlineMenuButtonClicked: ({ port }: PortConnectionParam) => void;
|
autofillInlineMenuButtonClicked: ({ port }: PortConnectionParam) => void;
|
||||||
triggerDelayedInlineMenuClosure: ({ port }: PortConnectionParam) => void;
|
triggerDelayedAutofillInlineMenuClosure: ({ port }: PortConnectionParam) => void;
|
||||||
autofillInlineMenuBlurred: () => void;
|
autofillInlineMenuBlurred: () => void;
|
||||||
redirectAutofillInlineMenuFocusOut: ({ message, port }: PortOnMessageHandlerParams) => void;
|
redirectAutofillInlineMenuFocusOut: ({ message, port }: PortOnMessageHandlerParams) => void;
|
||||||
updateAutofillInlineMenuColorScheme: () => void;
|
updateAutofillInlineMenuColorScheme: () => void;
|
||||||
|
|||||||
@@ -1326,6 +1326,8 @@ describe("OverlayBackground", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("triggerDelayedAutofillInlineMenuClosure", () => {});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("inline menu list message handlers", () => {});
|
describe("inline menu list message handlers", () => {});
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
|
|||||||
};
|
};
|
||||||
private readonly inlineMenuButtonPortMessageHandlers: InlineMenuButtonPortMessageHandlers = {
|
private readonly inlineMenuButtonPortMessageHandlers: InlineMenuButtonPortMessageHandlers = {
|
||||||
autofillInlineMenuButtonClicked: ({ port }) => this.handleInlineMenuButtonClicked(port),
|
autofillInlineMenuButtonClicked: ({ port }) => this.handleInlineMenuButtonClicked(port),
|
||||||
triggerDelayedInlineMenuClosure: ({ port }) =>
|
triggerDelayedAutofillInlineMenuClosure: ({ port }) =>
|
||||||
this.triggerDelayedInlineMenuClosure(port.sender),
|
this.triggerDelayedInlineMenuClosure(port.sender),
|
||||||
autofillInlineMenuBlurred: () => this.checkInlineMenuListFocused(),
|
autofillInlineMenuBlurred: () => this.checkInlineMenuListFocused(),
|
||||||
redirectAutofillInlineMenuFocusOut: ({ message, port }) =>
|
redirectAutofillInlineMenuFocusOut: ({ message, port }) =>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export class AutofillInlineMenuIframeService implements AutofillInlineMenuIframe
|
|||||||
private ariaAlertTimeout: number | NodeJS.Timeout;
|
private ariaAlertTimeout: number | NodeJS.Timeout;
|
||||||
private delayedCloseTimeout: number | NodeJS.Timeout;
|
private delayedCloseTimeout: number | NodeJS.Timeout;
|
||||||
private readonly fadeInOpacityTransition = "opacity 125ms ease-out 0s";
|
private readonly fadeInOpacityTransition = "opacity 125ms ease-out 0s";
|
||||||
private readonly fadeOutOpacityTransition = "opacity 60ms ease-out 0s";
|
private readonly fadeOutOpacityTransition = "opacity 65ms ease-out 0s";
|
||||||
private iframeStyles: Partial<CSSStyleDeclaration> = {
|
private iframeStyles: Partial<CSSStyleDeclaration> = {
|
||||||
all: "initial",
|
all: "initial",
|
||||||
position: "fixed",
|
position: "fixed",
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ describe("AutofillInlineMenuButton", () => {
|
|||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(globalThis.parent.postMessage).not.toHaveBeenCalledWith({
|
expect(globalThis.parent.postMessage).not.toHaveBeenCalledWith({
|
||||||
command: "triggerDelayedInlineMenuClosure",
|
command: "triggerDelayedAutofillInlineMenuClosure",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -85,7 +85,7 @@ describe("AutofillInlineMenuButton", () => {
|
|||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(globalThis.parent.postMessage).toHaveBeenCalledWith(
|
expect(globalThis.parent.postMessage).toHaveBeenCalledWith(
|
||||||
{ command: "triggerDelayedInlineMenuClosure", portKey },
|
{ command: "triggerDelayedAutofillInlineMenuClosure", portKey },
|
||||||
"*",
|
"*",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ class AutofillInlineMenuButton extends AutofillInlineMenuPageElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.postMessageToParent({ command: "triggerDelayedInlineMenuClosure" });
|
this.postMessageToParent({ command: "triggerDelayedAutofillInlineMenuClosure" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user