Browse Source

chore: add jest resizeobserver polyfill

代强 3 years ago
parent
commit
5244bea095
1 changed files with 14 additions and 0 deletions
  1. 14 0
      test/setup.js

+ 14 - 0
test/setup.js

@@ -21,6 +21,20 @@ Enzyme.configure({
     adapter: new Adapter(),
     adapter: new Adapter(),
 });
 });
 
 
+class ResizeObserver {
+    observe() {
+        // do nothing
+    }
+    unobserve() {
+        // do nothing
+    }
+    disconnect() {
+        // do nothing
+    }
+}
+
+global.ResizeObserver = ResizeObserver;
+
 // Define globals to cut down on imports in test file
 // Define globals to cut down on imports in test file
 global.React = React;
 global.React = React;
 global.shallow = shallow;
 global.shallow = shallow;