setupTests.js 559 Bytes
Newer Older
afc163's avatar
afc163 committed
1
/* eslint-disable import/first */
afc163's avatar
afc163 committed
2 3 4 5
global.requestAnimationFrame =
  global.requestAnimationFrame || function requestAnimationFrame(callback) {
    setTimeout(callback, 0);
  };
偏右's avatar
偏右 committed
6
import { jsdom } from 'jsdom';
afc163's avatar
afc163 committed
7
import Enzyme from 'enzyme';
afc163's avatar
afc163 committed
8
import Adapter from 'enzyme-adapter-react-16';
afc163's avatar
afc163 committed
9 10

Enzyme.configure({ adapter: new Adapter() });
偏右's avatar
偏右 committed
11 12 13 14 15 16

// fixed jsdom miss
const documentHTML = '<!doctype html><html><body><div id="root"></div></body></html>';
global.document = jsdom(documentHTML);
global.window = document.defaultView;
global.navigator = global.window.navigator;