test(web): polyfill CSS.supports in shared vitest setup (Seed TextField needs it)

This commit is contained in:
Munkherdene 2026-08-22 20:45:59 +08:00
parent efd252e8ff
commit 2555e42f21

View file

@ -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<string, string> = {};