File tree 2 files changed +15
-20
lines changed
2 files changed +15
-20
lines changed Original file line number Diff line number Diff line change
1
+ const mock = ( ) => {
2
+ const PopperJS = jest . requireActual ( '@popperjs/core' ) ;
3
+ return {
4
+ placements : PopperJS . placements ,
5
+ destroy : ( ) => { } ,
6
+ scheduleUpdate : ( ) => { } ,
7
+ forceUpdate : ( ) => { } ,
8
+ render : function ( this : any ) {
9
+ return this . $options . _renderChildren ;
10
+ } ,
11
+ } ;
12
+ } ;
13
+
14
+ export default mock ;
15
+ export { mock as createPopper } ;
Original file line number Diff line number Diff line change @@ -6,26 +6,6 @@ require('raf/polyfill');
6
6
*/
7
7
require ( 'mutationobserver-shim' ) ;
8
8
9
- /**
10
- * Mock PopperJS
11
- *
12
- * When using mount(), material-ui calls Popper.js, which is not compatible with JSDom
13
- * And causes UnhandledPromiseRejectionWarning: TypeError: document.createRange is not a function
14
- *
15
- * @see https://github.com/FezVrasta/popper.js/issues/478
16
- */
17
- jest . mock ( '@popperjs/core' , ( ) => {
18
- const PopperJS = jest . requireActual ( '@popperjs/core' ) ;
19
- return {
20
- placements : PopperJS . placements ,
21
- destroy : ( ) => { } ,
22
- scheduleUpdate : ( ) => { } ,
23
- render : function ( this ) {
24
- return this . $options . _renderChildren ;
25
- } ,
26
- } ;
27
- } ) ;
28
-
29
9
// Ignore warnings about act()
30
10
// See https://github.com/testing-library/react-testing-library/issues/281,
31
11
// https://github.com/facebook/react/issues/14769
You can’t perform that action at this time.
0 commit comments