45 lines
987 B
JavaScript
45 lines
987 B
JavaScript
import { afterEach, vi } from 'vitest'
|
|
import { enableAutoUnmount } from '@vue/test-utils'
|
|
|
|
enableAutoUnmount(afterEach)
|
|
|
|
if (!navigator.clipboard) {
|
|
navigator.clipboard = { writeText: vi.fn().mockResolvedValue(undefined) }
|
|
}
|
|
|
|
if (typeof globalThis.ResizeObserver === 'undefined') {
|
|
globalThis.ResizeObserver = class ResizeObserver {
|
|
observe () {}
|
|
unobserve () {}
|
|
disconnect () {}
|
|
}
|
|
}
|
|
|
|
if (typeof globalThis.IntersectionObserver === 'undefined') {
|
|
globalThis.IntersectionObserver = class IntersectionObserver {
|
|
observe () {}
|
|
unobserve () {}
|
|
disconnect () {}
|
|
takeRecords () {
|
|
return []
|
|
}
|
|
}
|
|
}
|
|
|
|
if (typeof window.matchMedia !== 'function') {
|
|
window.matchMedia = query => ({
|
|
matches: false,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: () => {},
|
|
removeListener: () => {},
|
|
addEventListener: () => {},
|
|
removeEventListener: () => {},
|
|
dispatchEvent: () => false,
|
|
})
|
|
}
|
|
|
|
afterEach(() => {
|
|
vi.restoreAllMocks()
|
|
})
|