From 2555e42f2151b13fd4d4dfbf02dbd6065d6bcf0c Mon Sep 17 00:00:00 2001 From: Munkherdene Date: Sat, 22 Aug 2026 20:45:59 +0800 Subject: [PATCH] test(web): polyfill CSS.supports in shared vitest setup (Seed TextField needs it) --- vitest.setup.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vitest.setup.ts b/vitest.setup.ts index 2a9307e..59e1a08 100644 --- a/vitest.setup.ts +++ b/vitest.setup.ts @@ -1,5 +1,14 @@ import "@testing-library/jest-dom/vitest"; +// Polyfill CSS.supports for jsdom (Seed's TextField uses @seed-design/react-supports, +// which calls CSS.supports; jsdom provides no CSS global). Assume support so the +// component renders; jsdom doesn't apply the styles either way. +if (typeof CSS === "undefined") { + (global as any).CSS = { supports: () => true }; +} else if (typeof (CSS as any).supports !== "function") { + (CSS as any).supports = () => true; +} + // Polyfill localStorage for jsdom if not available if (typeof localStorage === "undefined") { const store: Record = {};