How to use the enzyme-adapter-utils.elementToTree 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
elementToNode(element) {
    return elementToTree(element);
  }
github airbnb / enzyme / packages / enzyme-adapter-react-16.1 / src / ReactSixteenOneAdapter.js View on Github external
function elementToTree(el) {
  if (!isPortal(el)) {
    return utilElementToTree(el, elementToTree);
  }

  const { children, containerInfo } = el;
  const props = { children, containerInfo };

  return {
    nodeType: 'portal',
    type: Portal,
    props,
    key: ensureKeyOrUndefined(el.key),
    ref: el.ref || null,
    instance: null,
    rendered: elementToTree(el.children),
  };
}
github airbnb / enzyme / packages / enzyme-adapter-react-16.2 / src / ReactSixteenTwoAdapter.js View on Github external
function elementToTree(el) {
  if (!isPortal(el)) {
    return utilElementToTree(el, elementToTree);
  }

  const { children, containerInfo } = el;
  const props = { children, containerInfo };

  return {
    nodeType: 'portal',
    type: Portal,
    props,
    key: ensureKeyOrUndefined(el.key),
    ref: el.ref || null,
    instance: null,
    rendered: elementToTree(el.children),
  };
}
github airbnb / enzyme / packages / enzyme-adapter-react-14 / src / ReactFourteenAdapter.js View on Github external
getNode() {
        if (isDOM) {
          return elementToTree(cachedNode);
        }
        const output = renderer.getRenderOutput();
        return {
          nodeType: typeToNodeType(cachedNode.type),
          type: cachedNode.type,
          props: cachedNode.props,
          key: ensureKeyOrUndefined(cachedNode.key),
          ref: cachedNode.ref,
          instance: renderer._instance._instance,
          rendered: elementToTree(output),
        };
      },
      simulateEvent(node, event, ...args) {
github airbnb / enzyme / packages / enzyme-adapter-react-14 / src / ReactFourteenAdapter.js View on Github external
getNode() {
        if (isDOM) {
          return elementToTree(cachedNode);
        }
        const output = renderer.getRenderOutput();
        return {
          nodeType: typeToNodeType(cachedNode.type),
          type: cachedNode.type,
          props: cachedNode.props,
          key: ensureKeyOrUndefined(cachedNode.key),
          ref: cachedNode.ref,
          instance: renderer._instance._instance,
          rendered: elementToTree(output),
        };
      },
      simulateEvent(node, event, ...args) {
github airbnb / enzyme / packages / enzyme-adapter-react-15.4 / src / ReactFifteenFourAdapter.js View on Github external
getNode() {
        if (isDOM) {
          return elementToTree(cachedNode);
        }
        const output = renderer.getRenderOutput();
        return {
          nodeType: compositeTypeToNodeType(renderer._instance._compositeType),
          type: cachedNode.type,
          props: cachedNode.props,
          key: ensureKeyOrUndefined(cachedNode.key),
          ref: cachedNode.ref,
          instance: renderer._instance._instance,
          rendered: elementToTree(output),
        };
      },
      simulateEvent(node, event, ...args) {
github zerobias / effector / src / fixtures / ReactSixteenAdapter.js View on Github external
getNode() {
        if (isDOM) {
          return elementToTree(cachedNode)
        }
        const output = renderer.getRenderOutput()
        return {
          nodeType: nodeTypeFromType(cachedNode.type),
          type: cachedNode.type,
          props: cachedNode.props,
          key: ensureKeyOrUndefined(cachedNode.key),
          ref: cachedNode.ref,
          instance: renderer._instance,
          rendered: Array.isArray(output)
            ? flatten(output).map(elementToTree)
            : elementToTree(output),
        }
      },
      simulateEvent(node, event, ...args) {