mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-08-02 19:30:15 +03:00
Update
This commit is contained in:
parent
40bc412d62
commit
533c813166
|
@ -1,40 +1,11 @@
|
|||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import { Editor } from '../src';
|
||||
import 'codemirror/mode/javascript/javascript';
|
||||
|
||||
describe('Editor', function () {
|
||||
const getBoundingClientRect = jest.fn();
|
||||
const getClientRects = jest.fn();
|
||||
|
||||
// See https://github.com/jsdom/jsdom/issues/3002
|
||||
document.createRange = () => {
|
||||
const range = new Range();
|
||||
|
||||
range.getBoundingClientRect = getBoundingClientRect;
|
||||
|
||||
range.getClientRects = () => {
|
||||
getClientRects();
|
||||
return {
|
||||
item: () => null,
|
||||
length: 0,
|
||||
[Symbol.iterator]: jest.fn(),
|
||||
};
|
||||
};
|
||||
|
||||
return range;
|
||||
};
|
||||
const { container } = render(<Editor value="var a = 1;" />);
|
||||
|
||||
it('renders correctly', () => {
|
||||
expect(container.firstChild).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('calls getBoundingClientRect', () => {
|
||||
expect(getBoundingClientRect).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('calls getClientRects', () => {
|
||||
expect(getClientRects).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user