feat: 升级 Ant Design 6 并实现主题切换功能
- 升级 antd 从 5.24.9 到 6.3.5,@ant-design/icons 从 5.6.1 到 6.1.1 - 新增 ThemeContext 和 ThemeToggle 组件,支持明暗主题切换 - 移除自定义 SCSS 样式,采用 Ant Design 主题系统 - 测试环境从 jsdom 切换到 happy-dom,提升测试性能 - 更新 AppLayout、ModelForm、ProviderForm 以适配新主题系统
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
import '@testing-library/jest-dom/vitest';
|
||||
|
||||
// Ensure jsdom environment is properly initialized
|
||||
if (typeof window === 'undefined' || typeof document === 'undefined') {
|
||||
throw new Error('jsdom environment not initialized. Check vitest config.');
|
||||
}
|
||||
|
||||
// Polyfill window.matchMedia for jsdom (required by antd)
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
@@ -24,3 +29,11 @@ window.getComputedStyle = (elt: Element, pseudoElt?: string | null) => {
|
||||
return {} as CSSStyleDeclaration;
|
||||
}
|
||||
};
|
||||
|
||||
// Polyfill ResizeObserver for antd
|
||||
global.ResizeObserver = class ResizeObserver {
|
||||
observe() {}
|
||||
unobserve() {}
|
||||
disconnect() {}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user