-
-
Notifications
You must be signed in to change notification settings - Fork 2k
[Fix] Convert nodes to RST nodes before comparing #1423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
161172d
bd12012
16ea7d4
7cb7a06
2f299d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -374,9 +374,13 @@ class ReactWrapper { | |
| * @returns {Boolean} | ||
| */ | ||
| contains(nodeOrNodes) { | ||
| const isArray = Array.isArray(nodeOrNodes); | ||
| const rstNodeOrNodes = isArray | ||
| ? nodeOrNodes.map(getAdapter().elementToNode) | ||
| : getAdapter().elementToNode(nodeOrNodes); | ||
| const predicate = Array.isArray(nodeOrNodes) | ||
| ? other => containsChildrenSubArray(nodeEqual, other, nodeOrNodes) | ||
| : other => nodeEqual(nodeOrNodes, other); | ||
| ? other => containsChildrenSubArray(nodeEqual, other, rstNodeOrNodes) | ||
|
||
| : other => nodeEqual(rstNodeOrNodes, other); | ||
| return findWhereUnwrapped(this, predicate).length > 0; | ||
| } | ||
|
|
||
|
|
@@ -397,7 +401,8 @@ class ReactWrapper { | |
| * @returns {Boolean} | ||
| */ | ||
| containsMatchingElement(node) { | ||
| const predicate = other => nodeMatches(node, other, (a, b) => a <= b); | ||
| const rstNode = getAdapter().elementToNode(node); | ||
| const predicate = other => nodeMatches(rstNode, other, (a, b) => a <= b); | ||
| return findWhereUnwrapped(this, predicate).length > 0; | ||
| } | ||
|
|
||
|
|
@@ -424,7 +429,9 @@ class ReactWrapper { | |
| throw new TypeError('nodes should be an Array'); | ||
| } | ||
|
|
||
| return nodes.every(node => this.containsMatchingElement(node)); | ||
| const rstNodes = nodes.map(getAdapter().elementToNode); | ||
|
|
||
| return rstNodes.every(rstNode => this.containsMatchingElement(rstNode)); | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -446,7 +453,10 @@ class ReactWrapper { | |
| * @returns {Boolean} | ||
| */ | ||
| containsAnyMatchingElements(nodes) { | ||
| return Array.isArray(nodes) && nodes.some(node => this.containsMatchingElement(node)); | ||
| const rstNodes = nodes.map(getAdapter().elementToNode); | ||
|
||
|
|
||
| return Array.isArray(rstNodes) | ||
| && rstNodes.some(rstNode => this.containsMatchingElement(rstNode)); | ||
| } | ||
|
|
||
| /** | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line can use
isArraynow, I think?