1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-01-24 21:41:33 +01:00

[PM-5189] Fixing existing jest tests before undergoing larger scale rework of tests

This commit is contained in:
Cesar Gonzalez 2024-06-04 10:21:58 -05:00
parent d774bc96d9
commit f3c0a24a1d
No known key found for this signature in database
GPG Key ID: 3381A5457F8CCECF
3 changed files with 3 additions and 16 deletions

View File

@ -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" };

View File

@ -248,7 +248,6 @@ export class AutofillInlineMenuIframeService implements AutofillInlineMenuIframe
}
this.updateElementStyles(this.iframe, position);
// setTimeout(() => this.updateElementStyles(this.iframe, { opacity: "1" }), 0);
this.announceAriaAlert();
}

View File

@ -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<FormFieldElement>;
const autofillField = mock<AutofillField>();
const entries = [
{ target: formFieldElement, isIntersecting: true },
] as unknown as IntersectionObserverEntry[];
collectAutofillContentService["autofillFieldElements"].set(formFieldElement, autofillField);
isFormFieldViewableSpy.mockReturnValueOnce(false);
await collectAutofillContentService["handleFormElementIntersection"](entries);