From 4f879abe22021cc1a9a4d3ae510bc7569a550980 Mon Sep 17 00:00:00 2001 From: Mohamed Boudra Date: Wed, 4 Nov 2026 09:41:41 +0100 Subject: [PATCH] test(plugins): the retained input liveness test runs in real Chromium --- ...st.tsx => use-input-live.browser.test.tsx} | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) rename packages/app/src/composer/input/{use-input-live.test.tsx => use-input-live.browser.test.tsx} (76%) diff --git a/packages/app/src/composer/input/use-input-live.test.tsx b/packages/app/src/composer/input/use-input-live.browser.test.tsx similarity index 76% rename from packages/app/src/composer/input/use-input-live.test.tsx rename to packages/app/src/composer/input/use-input-live.browser.test.tsx index 92def416d6..d9e20029ca 100644 --- a/packages/app/src/composer/input/use-input-live.test.tsx +++ b/packages/app/src/composer/input/use-input-live.browser.test.tsx @@ -1,21 +1,18 @@ -/** - * @vitest-environment jsdom - */ import React, { act } from "react"; import { createRoot } from "react-dom/client"; -import { afterEach, beforeEach, expect, it, vi } from "vitest"; +import { beforeEach, expect, it, vi } from "vitest"; import { RetainedPanelActivity } from "@/components/retained-panel"; import { useIsInputLive } from "./use-input-live"; -// App sources compile against the classic JSX runtime, which expects React on the global. +// App sources compile against the classic JSX runtime, which expects React on the global, as the +// other browser tests here arrange. beforeEach(() => vi.stubGlobal("React", React)); -afterEach(() => vi.unstubAllGlobals()); -function render( - active: boolean, - input: { current: unknown }, - publish: (isLive: () => boolean) => void, -) { +interface InputRef { + current: object | null; +} + +function render(active: boolean, input: InputRef, publish: (isLive: () => boolean) => void) { function Probe() { publish(useIsInputLive(input)); return null; @@ -28,7 +25,7 @@ function render( } it("an input kept mounted in a panel that is not showing is not live", () => { - const input: { current: object | null } = { current: {} }; + const input: InputRef = { current: {} }; let isLive: () => boolean = () => false; const publish = (read: () => boolean) => { isLive = read;