From 2d1b097e0737cf3e2fe0256ad66d7178865d7a8f Mon Sep 17 00:00:00 2001 From: David Godfrey Date: Sun, 17 Jun 2018 13:52:26 +0100 Subject: [PATCH] Match descendants only Selectors like '.foo div' should not match on '
' --- packages/enzyme/src/selectors.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/enzyme/src/selectors.js b/packages/enzyme/src/selectors.js index 8342dde1a..cd566c0e0 100644 --- a/packages/enzyme/src/selectors.js +++ b/packages/enzyme/src/selectors.js @@ -317,7 +317,7 @@ function matchDirectChild(nodes, predicate) { function matchDescendant(nodes, predicate) { return uniqueReduce( (matches, node) => matches.concat(treeFilter(node, predicate)), - nodes, + flatten(nodes.map(childrenOfNode)), ); }