diff --git a/packages/react-code-editor/src/components/CodeEditor/__test__/CodeEditor.test.tsx b/packages/react-code-editor/src/components/CodeEditor/__test__/CodeEditor.test.tsx index f8927aa6e3a..544d5451ea7 100644 --- a/packages/react-code-editor/src/components/CodeEditor/__test__/CodeEditor.test.tsx +++ b/packages/react-code-editor/src/components/CodeEditor/__test__/CodeEditor.test.tsx @@ -2,6 +2,20 @@ import React from 'react'; import { render } from '@testing-library/react'; import { CodeEditor, Language } from '../CodeEditor'; +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('CodeEditor', () => { beforeAll(() => { window.HTMLCanvasElement.prototype.getContext = () => ({} as any); diff --git a/packages/react-code-editor/src/components/CodeEditor/__test__/__snapshots__/CodeEditor.test.tsx.snap b/packages/react-code-editor/src/components/CodeEditor/__test__/__snapshots__/CodeEditor.test.tsx.snap index 3edfa6df0dd..395479988f5 100644 --- a/packages/react-code-editor/src/components/CodeEditor/__test__/__snapshots__/CodeEditor.test.tsx.snap +++ b/packages/react-code-editor/src/components/CodeEditor/__test__/__snapshots__/CodeEditor.test.tsx.snap @@ -142,7 +142,7 @@ exports[`CodeEditor matches snapshot with all props 1`] = ` >
@@ -199,6 +199,11 @@ exports[`CodeEditor matches snapshot with all props 1`] = ` class="view-rulers" role="presentation" /> +