test(web): polyfill CSS.supports in shared vitest setup (Seed TextField needs it)
This commit is contained in:
parent
efd252e8ff
commit
2555e42f21
1 changed files with 9 additions and 0 deletions
|
|
@ -1,5 +1,14 @@
|
||||||
import "@testing-library/jest-dom/vitest";
|
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
|
// Polyfill localStorage for jsdom if not available
|
||||||
if (typeof localStorage === "undefined") {
|
if (typeof localStorage === "undefined") {
|
||||||
const store: Record<string, string> = {};
|
const store: Record<string, string> = {};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue