27 lines
621 B
TypeScript
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(),
|
|
}))
|