How to use the enzyme-adapter-utils.displayNameOfNode 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 airbnb / enzyme / packages / enzyme-adapter-react-16.3 / src / ReactSixteenThreeAdapter.js View on Github external
checkPropTypes(typeSpecs, values, location, hierarchy) {
        return checkPropTypes(
          typeSpecs,
          values,
          location,
          displayNameOfNode(cachedNode),
          () => getComponentStack(hierarchy.concat([cachedNode])),
        );
      },
    };
github airbnb / enzyme / packages / enzyme-adapter-react-16.1 / src / ReactSixteenOneAdapter.js View on Github external
displayNameOfNode(node) {
    if (!node) return null;

    const { type, $$typeof } = node;
    return displayNamesByType[type || $$typeof] || displayNameOfNode(node);
  }
github airbnb / enzyme / packages / enzyme-adapter-react-16 / src / ReactSixteenAdapter.js View on Github external
case ContextProvider || NaN: return 'ContextProvider';
      case Memo || NaN: {
        const nodeName = displayNameOfNode(node);
        return typeof nodeName === 'string' ? nodeName : `Memo(${displayNameOfNode(type)})`;
      }
      case ForwardRef || NaN: {
        if (type.displayName) {
          return type.displayName;
        }
        const name = displayNameOfNode({ type: type.render });
        return name ? `ForwardRef(${name})` : 'ForwardRef';
      }
      case Lazy || NaN: {
        return 'lazy';
      }
      default: return displayNameOfNode(node);
    }
  }
github airbnb / enzyme / packages / enzyme-adapter-react-16.2 / src / ReactSixteenTwoAdapter.js View on Github external
checkPropTypes(typeSpecs, values, location, hierarchy) {
        return checkPropTypes(
          typeSpecs,
          values,
          location,
          displayNameOfNode(cachedNode),
          () => getComponentStack(hierarchy.concat([cachedNode])),
        );
      },
    };
github airbnb / enzyme / packages / enzyme-adapter-react-16 / src / ReactSixteenAdapter.js View on Github external
checkPropTypes(typeSpecs, values, location, hierarchy) {
        return checkPropTypes(
          typeSpecs,
          values,
          location,
          displayNameOfNode(cachedNode),
          () => getComponentStack(hierarchy.concat([cachedNode])),
        );
      },
    };
github airbnb / enzyme / packages / enzyme-adapter-react-16.1 / src / ReactSixteenOneAdapter.js View on Github external
checkPropTypes(typeSpecs, values, location, hierarchy) {
        return checkPropTypes(
          typeSpecs,
          values,
          location,
          displayNameOfNode(cachedNode),
          () => getComponentStack(hierarchy.concat([cachedNode])),
        );
      },
    };
github airbnb / enzyme / packages / enzyme-adapter-react-16.3 / src / ReactSixteenThreeAdapter.js View on Github external
}
    }

    const $$typeofType = type && type.$$typeof;

    switch ($$typeofType) {
      case ContextConsumer || NaN: return 'ContextConsumer';
      case ContextProvider || NaN: return 'ContextProvider';
      case ForwardRef || NaN: {
        if (type.displayName) {
          return type.displayName;
        }
        const name = displayNameOfNode({ type: type.render });
        return name ? `ForwardRef(${name})` : 'ForwardRef';
      }
      default: return displayNameOfNode(node);
    }
  }