How to use the enzyme/build/RSTTraversal.childrenOfNode function in enzyme

To help you get started, we’ve selected a few enzyme 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 adriantoine / enzyme-to-json / src / mount.js View on Github external
function getChildren(node, options) {
  if (options.mode === 'shallow' && typeof node.type === 'function') {
    return null;
  }

  const children = compact(
    childrenOfNode(node).map(n => internalNodeToJson(n, options)),
  );

  return children.length > 0 ? children : null;
}
github adriantoine / enzyme-to-json / src / shallow.js View on Github external
function getChildren(node, options) {
  const children = compact(
    childrenOfNode(node).map(n => internalNodeToJson(n, options)),
  );

  if (children.length > 0) {
    return children;
  }

  return null;
}