Files
weiguang-jewelry-ledger/新账系统/web/test/setup.ts
T
黄健铭andClaude Opus 5.5 ec5889075f 新版界面(React + TypeScript + Vite + Ant Design):登录页与开单页
共用计算经构建插件直接导入 public/ 下的 UMD 源文件;请求客户端沿用旧界面的重试、
同一操作号自动确认、恢复原操作与账号切换约定;附 vitest 单元与组件测试。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-04 18:58:31 -08:00

30 lines
930 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import '@testing-library/jest-dom/vitest';
import { afterEach } from 'vitest';
import { cleanup } from '@testing-library/react';
afterEach(() => cleanup());
// antd 的响应式组件依赖 matchMedia;jsdom 未实现。
if (!window.matchMedia)
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: (query: string) => ({
matches: false,
media: query,
onchange: null,
addListener() {},
removeListener() {},
addEventListener() {},
removeEventListener() {},
dispatchEvent: () => false,
}),
});
if (!window.ResizeObserver)
window.ResizeObserver = class {
observe() {}
unobserve() {}
disconnect() {}
} as unknown as typeof ResizeObserver;
// jsdom 的 getComputedStyle 不支持伪元素参数,antd 会调用并打印告警。
const original = window.getComputedStyle;
window.getComputedStyle = (element: Element) => original(element);