setupTests.js 563 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);
  };
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

// fixed jsdom miss
const documentHTML = '<!doctype html><html><body><div id="root"></div></body></html>';
14
global.document = new JSDOM(documentHTML);
偏右's avatar
偏右 committed
15 16
global.window = document.defaultView;
global.navigator = global.window.navigator;