From dd8d8c794010bca087859650093b048a2c0a6d3f Mon Sep 17 00:00:00 2001 From: JC Franco Date: Fri, 25 Oct 2024 15:37:46 -0700 Subject: [PATCH] refactor: remove unnecessary `skipAnimations` delay workaround (#10614) **Related Issue:** N/A ## Summary Removes workaround no longer needed after #6604. --- .../src/tests/commonTests/openClose.ts | 10 +++------- packages/calcite-components/src/tests/utils.ts | 4 +--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/calcite-components/src/tests/commonTests/openClose.ts b/packages/calcite-components/src/tests/commonTests/openClose.ts index edba09338c1..7366d7298f7 100644 --- a/packages/calcite-components/src/tests/commonTests/openClose.ts +++ b/packages/calcite-components/src/tests/commonTests/openClose.ts @@ -1,6 +1,6 @@ import { E2EPage } from "@stencil/core/testing"; import { toHaveNoViolations } from "jest-axe"; -import { GlobalTestProps, newProgrammaticE2EPage, toElementHandle } from "../utils"; +import { GlobalTestProps, newProgrammaticE2EPage, skipAnimations, toElementHandle } from "../utils"; import { getBeforeContent, getTagAndPage, noopBeforeContent } from "./utils"; import { ComponentTag, ComponentTestSetup, WithBeforeContent } from "./interfaces"; @@ -71,9 +71,7 @@ export function openClose(componentTestSetup: ComponentTestSetup, options?: Open it(`emits with animations disabled`, async () => { const { page, tag } = await getTagAndPage(componentTestSetup); - await page.addStyleTag({ - content: `:root { --calcite-duration-factor: 0; }`, - }); + await skipAnimations(page); await setUpEventListeners(tag, page); await testOpenCloseEvents({ animationsEnabled: false, @@ -122,9 +120,7 @@ openClose.initial = function openCloseInitial( it("emits on initialization with animations disabled", async () => { const page = await newProgrammaticE2EPage(); - await page.addStyleTag({ - content: `:root { --calcite-duration-factor: 0; }`, - }); + await skipAnimations(page); await beforeContent(page); await setUpEventListeners(tag, page); await testOpenCloseEvents({ diff --git a/packages/calcite-components/src/tests/utils.ts b/packages/calcite-components/src/tests/utils.ts index c64fff61c50..7379bef43fa 100644 --- a/packages/calcite-components/src/tests/utils.ts +++ b/packages/calcite-components/src/tests/utils.ts @@ -324,9 +324,7 @@ export async function newProgrammaticE2EPage(): Promise { */ export async function skipAnimations(page: E2EPage): Promise { await page.addStyleTag({ - // using 0.01 to ensure `openCloseComponent` utils work consistently - // this should be removed once https://github.com/Esri/calcite-design-system/issues/6604 is addressed - content: `:root { --calcite-duration-factor: 0.01; }`, + content: `:root { --calcite-duration-factor: 0; }`, }); }