forked from marmelab/react-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-setup.js
44 lines (41 loc) · 1.12 KB
/
test-setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require('raf/polyfill');
var enzyme = require('enzyme');
var Adapter = require('enzyme-adapter-react-16');
enzyme.configure({ adapter: new Adapter() });
/**
* Mock PopperJS
*
* When using mount(), material-ui calls Popper.js, which is not compatible with JSDom
* And causes UnhandledPromiseRejectionWarning: TypeError: document.createRange is not a function
*
* @see https://github.com/FezVrasta/popper.js/issues/478
* */
jest.mock(
'popper.js',
() =>
class Popper {
static placements = [
'auto',
'auto-end',
'auto-start',
'bottom',
'bottom-end',
'bottom-start',
'left',
'left-end',
'left-start',
'right',
'right-end',
'right-start',
'top',
'top-end',
'top-start',
];
constructor() {
return {
destroy: () => {},
scheduleUpdate: () => {},
};
}
}
);