How to use the enzyme-adapter-utils.createMountWrapper function in enzyme-adapter-utils

To help you get started, we’ve selected a few enzyme-adapter-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github skbkontur / react-ui-tour / testsSetup / ReactSixteenAdapter.ts View on Github external
render(el, context, callback) {
        if (instance === null) {
          const ReactWrapperComponent = createMountWrapper(el, options);
          const wrappedEl = React.createElement(ReactWrapperComponent, {
            Component: el.type,
            props: el.props,
            context
          });
          instance = ReactDOM.render(wrappedEl, domNode);
          if (typeof callback === "function") {
            callback();
          }
        } else {
          instance.setChildProps(el.props, context, callback);
        }
      },
      unmount() {
github unsplash / react-progressive-enhancement / tests / ReactSixteenAdapter.js View on Github external
render(el, context, callback) {
        if (instance === null) {
          const ReactWrapperComponent = createMountWrapper(el, options);
          const wrappedEl = React.createElement(ReactWrapperComponent, {
            Component: el.type,
            props: el.props,
            context,
          });
          instance = ReactDOM.render(wrappedEl, domNode);
          if (typeof callback === 'function') {
            callback();
          }
        } else {
          instance.setChildProps(el.props, context, callback);
        }
      },
      unmount() {
github airbnb / enzyme / packages / enzyme-adapter-react-16 / src / ReactSixteenAdapter.js View on Github external
return wrapAct(() => {
          if (instance === null) {
            const { type, props, ref } = el;
            const wrapperProps = {
              Component: type,
              props,
              wrappingComponentProps,
              context,
              ...(ref && { refProp: ref }),
            };
            const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });
            const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
            instance = hydrateIn
              ? ReactDOM.hydrate(wrappedEl, domNode)
              : ReactDOM.render(wrappedEl, domNode);
            if (typeof callback === 'function') {
              callback();
            }
          } else {
            instance.setChildProps(el.props, context, callback);
          }
        });
      },
github airbnb / enzyme / packages / enzyme-adapter-react-14 / src / ReactFourteenAdapter.js View on Github external
render(el, context, callback) {
        if (instance === null) {
          const { type, props, ref } = el;
          const wrapperProps = {
            Component: type,
            props,
            context,
            ...(ref && { ref }),
          };
          const ReactWrapperComponent = createMountWrapper(el, options);
          const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
          instance = ReactDOM.render(wrappedEl, domNode);
          if (typeof callback === 'function') {
            callback();
          }
        } else {
          instance.setChildProps(el.props, context, callback);
        }
      },
      unmount() {
github airbnb / enzyme / packages / enzyme-adapter-react-16 / src / ReactSixteenAdapter.js View on Github external
render(el, context, callback) {
        if (instance === null) {
          const { type, props, ref } = el;
          const wrapperProps = {
            Component: type,
            props,
            context,
            ...(ref && { ref }),
          };
          const ReactWrapperComponent = createMountWrapper(el, options);
          const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
          instance = hydrateIn
            ? ReactDOM.hydrate(wrappedEl, domNode)
            : ReactDOM.render(wrappedEl, domNode);
          if (typeof callback === 'function') {
            callback();
          }
        } else {
          instance.setChildProps(el.props, context, callback);
        }
      },
      unmount() {
github airbnb / enzyme / packages / enzyme-adapter-react-13 / src / ReactThirteenAdapter.js View on Github external
render(el, context, callback) {
        if (instance === null) {
          const { ref, type, props } = el;
          const wrapperProps = {
            Component: type,
            props,
            context,
            ...(ref && { ref }),
          };
          const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });
          const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
          instance = React.render(wrappedEl, domNode);
          if (typeof callback === 'function') {
            callback();
          }
        } else {
          instance.setChildProps(el.props, context, callback);
        }
      },
      unmount() {
github airbnb / enzyme / packages / enzyme-adapter-react-15.4 / src / ReactFifteenFourAdapter.js View on Github external
render(el, context, callback) {
        if (instance === null) {
          const { type, props, ref } = el;
          const wrapperProps = {
            Component: type,
            wrappingComponentProps: options.wrappingComponentProps,
            props,
            context,
            ...(ref && { refProp: ref }),
          };
          const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });
          const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
          instance = ReactDOM.render(wrappedEl, domNode);
          if (typeof callback === 'function') {
            callback();
          }
        } else {
          instance.setChildProps(el.props, context, callback);
        }
      },
      unmount() {
github airbnb / enzyme / packages / enzyme-adapter-react-13 / src / ReactThirteenAdapter.js View on Github external
render(el, context, callback) {
        if (instance === null) {
          const { ref, type, props } = el;
          const wrapperProps = {
            Component: type,
            props,
            context,
            ...(ref && { ref }),
          };
          const ReactWrapperComponent = createMountWrapper(el, options);
          const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
          instance = React.render(wrappedEl, domNode);
          if (typeof callback === 'function') {
            callback();
          }
        } else {
          instance.setChildProps(el.props, context, callback);
        }
      },
      unmount() {
github airbnb / enzyme / packages / enzyme-adapter-react-16.2 / src / ReactSixteenTwoAdapter.js View on Github external
render(el, context, callback) {
        if (instance === null) {
          const { type, props, ref } = el;
          const wrapperProps = {
            Component: type,
            props,
            wrappingComponentProps,
            context,
            ...(ref && { refProp: ref }),
          };
          const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });
          const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
          instance = hydrateIn
            ? ReactDOM.hydrate(wrappedEl, domNode)
            : ReactDOM.render(wrappedEl, domNode);
          if (typeof callback === 'function') {
            callback();
          }
        } else {
          instance.setChildProps(el.props, context, callback);
        }
      },
      unmount() {
github airbnb / enzyme / packages / enzyme-adapter-react-15 / src / ReactFifteenAdapter.js View on Github external
render(el, context, callback) {
        if (instance === null) {
          const { type, props, ref } = el;
          const wrapperProps = {
            Component: type,
            wrappingComponentProps: options.wrappingComponentProps,
            props,
            context,
            ...(ref && { refProp: ref }),
          };
          const ReactWrapperComponent = createMountWrapper(el, { ...options, adapter });
          const wrappedEl = React.createElement(ReactWrapperComponent, wrapperProps);
          instance = ReactDOM.render(wrappedEl, domNode);
          if (typeof callback === 'function') {
            callback();
          }
        } else {
          instance.setChildProps(el.props, context, callback);
        }
      },
      unmount() {