Skip to content

Commit

Permalink
Dirty fix for enzyme matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Nov 9, 2021
1 parent f6adf81 commit df83ee6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/jest/src/utils.js
Expand Up @@ -58,7 +58,9 @@ function getClassNameProp(node) {
return (node && node.prop('className')) || ''
}

function getClassNamesFromEnzyme(selectors, node) {
function getClassNamesFromEnzyme(selectors, nodeWithFragment) {
// TODO: Does approach work with older Emotion versions? Does it cause false positives with components named "Fragment" that aren't `React.Fragment`?
const node = nodeWithFragment.name() === 'Fragment' ? nodeWithFragment.children() : nodeWithFragment
// We need to dive in to get the className if we have a styled element from a shallow render
const isShallow = shouldDive(node)
const nodeWithClassName = findNodeWithClassName(
Expand Down

0 comments on commit df83ee6

Please sign in to comment.