mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-22 22:19:48 +03:00
Mock matchMedia
This commit is contained in:
parent
c09b781c90
commit
5e3714349b
|
@ -2,6 +2,20 @@ import React from 'react';
|
|||
import { render } from '@testing-library/react';
|
||||
import { Container } from '../src';
|
||||
|
||||
Object.defineProperty(window, 'matchMedia', {
|
||||
writable: true,
|
||||
value: jest.fn().mockImplementation((query) => ({
|
||||
matches: false,
|
||||
media: query,
|
||||
onchange: null,
|
||||
addListener: jest.fn(), // deprecated
|
||||
removeListener: jest.fn(), // deprecated
|
||||
addEventListener: jest.fn(),
|
||||
removeEventListener: jest.fn(),
|
||||
dispatchEvent: jest.fn(),
|
||||
})),
|
||||
});
|
||||
|
||||
describe('Container', function () {
|
||||
it('renders correctly', () => {
|
||||
const { container } = render(
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
exports[`Container renders correctly 1`] = `
|
||||
<div
|
||||
class="sc-bdvvtL gyKeHC"
|
||||
class="sc-bdvvtL bKcxHw"
|
||||
>
|
||||
Text
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user