Skip to content

Commit

Permalink
Don't attempt to match non-strings in fuzzy attribute selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Dail authored and ljharb committed Sep 26, 2017
1 parent 4c19481 commit de3069d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/enzyme/src/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ function matchAttributeSelector(node, token) {
return Object.prototype.hasOwnProperty.call(nodeProps, token.name);
}
// Only the exact value operator ("=") can match non-strings
if (typeof nodePropValue !== 'string' && operator !== EXACT_ATTRIBUTE_OPERATOR) {
if (typeof nodePropValue !== 'string' || typeof value !== 'string') {
if (operator !== EXACT_ATTRIBUTE_OPERATOR) {
return false;
}
}
switch (operator) {
/**
* Represents an element with the att attribute whose value is exactly "val".
Expand Down

0 comments on commit de3069d

Please sign in to comment.