From f3c0a24a1d57bd9cfb02b427235029359c5a1262 Mon Sep 17 00:00:00 2001 From: Cesar Gonzalez Date: Tue, 4 Jun 2024 10:21:58 -0500 Subject: [PATCH] [PM-5189] Fixing existing jest tests before undergoing larger scale rework of tests --- .../autofill-inline-menu-iframe.service.spec.ts | 16 +--------------- .../autofill-inline-menu-iframe.service.ts | 1 - .../collect-autofill-content.service.spec.ts | 2 ++ 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/apps/browser/src/autofill/overlay/inline-menu/iframe-content/autofill-inline-menu-iframe.service.spec.ts b/apps/browser/src/autofill/overlay/inline-menu/iframe-content/autofill-inline-menu-iframe.service.spec.ts index e0610bd1486..b18e01c2dd9 100644 --- a/apps/browser/src/autofill/overlay/inline-menu/iframe-content/autofill-inline-menu-iframe.service.spec.ts +++ b/apps/browser/src/autofill/overlay/inline-menu/iframe-content/autofill-inline-menu-iframe.service.spec.ts @@ -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", () => { - jest.spyOn(autofillInlineMenuIframeService as any, "updateInlineMenuIframePosition"); + jest.spyOn(autofillInlineMenuIframeService as any, "updateIframePosition"); sendPortMessage(portSpy, { command: "updateInlineMenuIframePosition" }); @@ -363,20 +363,6 @@ describe("AutofillInlineMenuIframeService", () => { 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", () => { jest.useFakeTimers(); const styles = { top: "100px", left: "100px" }; diff --git a/apps/browser/src/autofill/overlay/inline-menu/iframe-content/autofill-inline-menu-iframe.service.ts b/apps/browser/src/autofill/overlay/inline-menu/iframe-content/autofill-inline-menu-iframe.service.ts index af551ad388b..efab7cba6fb 100644 --- a/apps/browser/src/autofill/overlay/inline-menu/iframe-content/autofill-inline-menu-iframe.service.ts +++ b/apps/browser/src/autofill/overlay/inline-menu/iframe-content/autofill-inline-menu-iframe.service.ts @@ -248,7 +248,6 @@ export class AutofillInlineMenuIframeService implements AutofillInlineMenuIframe } this.updateElementStyles(this.iframe, position); - // setTimeout(() => this.updateElementStyles(this.iframe, { opacity: "1" }), 0); this.announceAriaAlert(); } diff --git a/apps/browser/src/autofill/services/collect-autofill-content.service.spec.ts b/apps/browser/src/autofill/services/collect-autofill-content.service.spec.ts index 57809c44262..62db535ecd8 100644 --- a/apps/browser/src/autofill/services/collect-autofill-content.service.spec.ts +++ b/apps/browser/src/autofill/services/collect-autofill-content.service.spec.ts @@ -2579,9 +2579,11 @@ describe("CollectAutofillContentService", () => { it("skips setting up the overlay listeners on a field that is not viewable", async () => { const formFieldElement = document.createElement("input") as ElementWithOpId; + const autofillField = mock(); const entries = [ { target: formFieldElement, isIntersecting: true }, ] as unknown as IntersectionObserverEntry[]; + collectAutofillContentService["autofillFieldElements"].set(formFieldElement, autofillField); isFormFieldViewableSpy.mockReturnValueOnce(false); await collectAutofillContentService["handleFormElementIntersection"](entries);