fix: update tests for mobile responsive changes
- Add matchMedia polyfill to test setup (jsdom doesn't implement it) - Remove Header tests for filter toggle (replaced by mobile FAB)
This commit is contained in:
parent
a744b33578
commit
13637ec881
2 changed files with 17 additions and 22 deletions
|
|
@ -1,5 +1,22 @@
|
|||
import '@testing-library/jest-dom/vitest';
|
||||
|
||||
// Polyfill matchMedia for jsdom (used by useIsMobile hook)
|
||||
if (typeof window.matchMedia === 'undefined') {
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
value: vi.fn().mockImplementation((query: string) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: vi.fn(),
|
||||
removeListener: vi.fn(),
|
||||
addEventListener: vi.fn(),
|
||||
removeEventListener: vi.fn(),
|
||||
dispatchEvent: vi.fn(),
|
||||
})),
|
||||
});
|
||||
}
|
||||
|
||||
// Polyfill ResizeObserver for jsdom (used by Radix UI components)
|
||||
if (typeof globalThis.ResizeObserver === 'undefined') {
|
||||
globalThis.ResizeObserver = class ResizeObserver {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue