mirror of
https://github.com/kremalicious/portfolio.git
synced 2024-12-22 17:23:22 +01:00
Matthias Kretschmann
447cada700
* next.js + typescript * more testing * script updates * fixes * favicon generation * testing * readme updates * tweaks * tweaks * move tests * image tweaks * ci tweaks * commit next-env.d.ts for ci * migrations * fixes * fixes * ci tweaks * new animations * project preview tweaks * add codeclimate config * dark mode refactor, test tweaks * readme updates * animation tweaks * animate in loaded images * test update * update humans.txt
28 lines
758 B
TypeScript
28 lines
758 B
TypeScript
const matchMediaMock = Object.defineProperty(window, 'matchMedia', {
|
|
writable: true,
|
|
value: jest
|
|
.fn()
|
|
.mockImplementationOnce((query) => ({
|
|
matches: false,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: jest.fn(), // deprecated
|
|
removeListener: jest.fn(), // deprecated
|
|
addEventListener: jest.fn(),
|
|
removeEventListener: jest.fn(),
|
|
dispatchEvent: jest.fn()
|
|
}))
|
|
.mockImplementation((query) => ({
|
|
matches: true,
|
|
media: query,
|
|
onchange: null,
|
|
addListener: jest.fn(), // deprecated
|
|
removeListener: jest.fn(), // deprecated
|
|
addEventListener: jest.fn(),
|
|
removeEventListener: jest.fn(),
|
|
dispatchEvent: jest.fn()
|
|
}))
|
|
})
|
|
|
|
export default matchMediaMock
|