Просмотр исходного кода

ref(test): Remove stubReactComponent (#13319)

Evan Purkhiser 5 лет назад
Родитель
Сommit
8657af5fb6
1 измененных файлов с 0 добавлено и 29 удалено
  1. 0 29
      tests/js/helpers/stubReactComponent.jsx

+ 0 - 29
tests/js/helpers/stubReactComponent.jsx

@@ -1,29 +0,0 @@
-// Inspired by TimothyRHuertas
-// https://gist.github.com/TimothyRHuertas/d7d06313c5411fe242bb
-import React from 'react';
-
-const divFactory = React.createFactory('div');
-const originalCreateElement = React.createElement;
-
-// eslint-disable-next-line import/no-anonymous-default-export
-export default function(stubber, stubbedComponents) {
-  stubber.stub(React, 'createElement', function(component, props) {
-    props = props || {};
-    if (stubbedComponents.indexOf(component) === -1) {
-      return originalCreateElement.apply(React, arguments);
-    } else {
-      const componentFactory = React.createFactory(component);
-      const displayName = componentFactory(props).type.displayName;
-
-      if (displayName) {
-        if (props.className) {
-          props.className = props.className + ' ' + displayName;
-        } else {
-          props.className = displayName;
-        }
-      }
-
-      return divFactory(props);
-    }
-  });
-}