mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
[PM-5189] Fixing existing jest tests before undergoing larger scale rework of tests
This commit is contained in:
@@ -193,7 +193,7 @@ describe("AutofillInlineMenuIframeService", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("handles port messages that are registered with the message handlers and does not pass the message on to the iframe", () => {
|
it("handles port messages that are registered with the message handlers and does not pass the message on to the iframe", () => {
|
||||||
jest.spyOn(autofillInlineMenuIframeService as any, "updateInlineMenuIframePosition");
|
jest.spyOn(autofillInlineMenuIframeService as any, "updateIframePosition");
|
||||||
|
|
||||||
sendPortMessage(portSpy, { command: "updateInlineMenuIframePosition" });
|
sendPortMessage(portSpy, { command: "updateInlineMenuIframePosition" });
|
||||||
|
|
||||||
@@ -363,20 +363,6 @@ describe("AutofillInlineMenuIframeService", () => {
|
|||||||
expect(autofillInlineMenuIframeService["iframe"].style.left).toBe(styles.left);
|
expect(autofillInlineMenuIframeService["iframe"].style.left).toBe(styles.left);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("fades the iframe element in after positioning the element", () => {
|
|
||||||
jest.useFakeTimers();
|
|
||||||
const styles = { top: "100px", left: "100px" };
|
|
||||||
|
|
||||||
sendPortMessage(portSpy, {
|
|
||||||
command: "updateInlineMenuIframePosition",
|
|
||||||
styles,
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(autofillInlineMenuIframeService["iframe"].style.opacity).toBe("0");
|
|
||||||
jest.advanceTimersByTime(10);
|
|
||||||
expect(autofillInlineMenuIframeService["iframe"].style.opacity).toBe("1");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("announces the opening of the iframe using an aria alert", () => {
|
it("announces the opening of the iframe using an aria alert", () => {
|
||||||
jest.useFakeTimers();
|
jest.useFakeTimers();
|
||||||
const styles = { top: "100px", left: "100px" };
|
const styles = { top: "100px", left: "100px" };
|
||||||
|
|||||||
@@ -248,7 +248,6 @@ export class AutofillInlineMenuIframeService implements AutofillInlineMenuIframe
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.updateElementStyles(this.iframe, position);
|
this.updateElementStyles(this.iframe, position);
|
||||||
// setTimeout(() => this.updateElementStyles(this.iframe, { opacity: "1" }), 0);
|
|
||||||
this.announceAriaAlert();
|
this.announceAriaAlert();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2579,9 +2579,11 @@ describe("CollectAutofillContentService", () => {
|
|||||||
|
|
||||||
it("skips setting up the overlay listeners on a field that is not viewable", async () => {
|
it("skips setting up the overlay listeners on a field that is not viewable", async () => {
|
||||||
const formFieldElement = document.createElement("input") as ElementWithOpId<FormFieldElement>;
|
const formFieldElement = document.createElement("input") as ElementWithOpId<FormFieldElement>;
|
||||||
|
const autofillField = mock<AutofillField>();
|
||||||
const entries = [
|
const entries = [
|
||||||
{ target: formFieldElement, isIntersecting: true },
|
{ target: formFieldElement, isIntersecting: true },
|
||||||
] as unknown as IntersectionObserverEntry[];
|
] as unknown as IntersectionObserverEntry[];
|
||||||
|
collectAutofillContentService["autofillFieldElements"].set(formFieldElement, autofillField);
|
||||||
isFormFieldViewableSpy.mockReturnValueOnce(false);
|
isFormFieldViewableSpy.mockReturnValueOnce(false);
|
||||||
|
|
||||||
await collectAutofillContentService["handleFormElementIntersection"](entries);
|
await collectAutofillContentService["handleFormElementIntersection"](entries);
|
||||||
|
|||||||
Reference in New Issue
Block a user