mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +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 = {
|
||||
[key: string]: CallableFunction;
|
||||
autofillInlineMenuButtonClicked: ({ port }: PortConnectionParam) => void;
|
||||
triggerDelayedInlineMenuClosure: ({ port }: PortConnectionParam) => void;
|
||||
triggerDelayedAutofillInlineMenuClosure: ({ port }: PortConnectionParam) => void;
|
||||
autofillInlineMenuBlurred: () => void;
|
||||
redirectAutofillInlineMenuFocusOut: ({ message, port }: PortOnMessageHandlerParams) => void;
|
||||
updateAutofillInlineMenuColorScheme: () => void;
|
||||
|
||||
@@ -1326,6 +1326,8 @@ describe("OverlayBackground", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("triggerDelayedAutofillInlineMenuClosure", () => {});
|
||||
});
|
||||
|
||||
describe("inline menu list message handlers", () => {});
|
||||
|
||||
@@ -99,7 +99,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
|
||||
};
|
||||
private readonly inlineMenuButtonPortMessageHandlers: InlineMenuButtonPortMessageHandlers = {
|
||||
autofillInlineMenuButtonClicked: ({ port }) => this.handleInlineMenuButtonClicked(port),
|
||||
triggerDelayedInlineMenuClosure: ({ port }) =>
|
||||
triggerDelayedAutofillInlineMenuClosure: ({ port }) =>
|
||||
this.triggerDelayedInlineMenuClosure(port.sender),
|
||||
autofillInlineMenuBlurred: () => this.checkInlineMenuListFocused(),
|
||||
redirectAutofillInlineMenuFocusOut: ({ message, port }) =>
|
||||
|
||||
@@ -18,7 +18,7 @@ export class AutofillInlineMenuIframeService implements AutofillInlineMenuIframe
|
||||
private ariaAlertTimeout: number | NodeJS.Timeout;
|
||||
private delayedCloseTimeout: number | NodeJS.Timeout;
|
||||
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> = {
|
||||
all: "initial",
|
||||
position: "fixed",
|
||||
|
||||
@@ -74,7 +74,7 @@ describe("AutofillInlineMenuButton", () => {
|
||||
await flushPromises();
|
||||
|
||||
expect(globalThis.parent.postMessage).not.toHaveBeenCalledWith({
|
||||
command: "triggerDelayedInlineMenuClosure",
|
||||
command: "triggerDelayedAutofillInlineMenuClosure",
|
||||
});
|
||||
});
|
||||
|
||||
@@ -85,7 +85,7 @@ describe("AutofillInlineMenuButton", () => {
|
||||
await flushPromises();
|
||||
|
||||
expect(globalThis.parent.postMessage).toHaveBeenCalledWith(
|
||||
{ command: "triggerDelayedInlineMenuClosure", portKey },
|
||||
{ command: "triggerDelayedAutofillInlineMenuClosure", portKey },
|
||||
"*",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -121,7 +121,7 @@ class AutofillInlineMenuButton extends AutofillInlineMenuPageElement {
|
||||
return;
|
||||
}
|
||||
|
||||
this.postMessageToParent({ command: "triggerDelayedInlineMenuClosure" });
|
||||
this.postMessageToParent({ command: "triggerDelayedAutofillInlineMenuClosure" });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user