Files
3dp-manager/client/test/mocks.tsx
T
2026-03-30 00:19:52 +03:00

27 lines
621 B
TypeScript

import { vi } from 'vitest'
// Мок для window.matchMedia
Object.defineProperty(window, 'matchMedia', {
writable: true,
value: vi.fn().mockImplementation(query => ({
matches: false,
media: query,
onchange: null,
addListener: vi.fn(),
removeListener: vi.fn(),
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
})),
})
// Мок для scrollIntoView
Element.prototype.scrollIntoView = vi.fn()
// Мок для IntersectionObserver
window.IntersectionObserver = vi.fn(() => ({
observe: vi.fn(),
unobserve: vi.fn(),
disconnect: vi.fn(),
}))