feat: implement comprehensive Form UI library with React Hook Form integration, Zod validation, and i18n support.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import '@testing-library/jest-dom/vitest';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Polyfill: window.matchMedia
|
||||
// ---------------------------------------------------------------------------
|
||||
// Mantine v8's MantineProvider calls window.matchMedia internally for
|
||||
// color scheme detection. jsdom does not implement matchMedia, so we
|
||||
// provide a minimal stub to prevent TypeError during test rendering.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
value: (query: string) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: () => {},
|
||||
removeListener: () => {},
|
||||
addEventListener: () => {},
|
||||
removeEventListener: () => {},
|
||||
dispatchEvent: () => false,
|
||||
}),
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Polyfill: ResizeObserver
|
||||
// ---------------------------------------------------------------------------
|
||||
// Some Mantine components (Popover, Select dropdown) use ResizeObserver
|
||||
// which is also not available in jsdom.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class ResizeObserverStub {
|
||||
observe() {}
|
||||
unobserve() {}
|
||||
disconnect() {}
|
||||
}
|
||||
|
||||
window.ResizeObserver = ResizeObserverStub as unknown as typeof ResizeObserver;
|
||||
Reference in New Issue
Block a user