Skip to content

Commit e954e46

Browse files
committed
[Fix] shallow/mount: matchesElement/containsMatchingElement: get adapter with options
1 parent 6767ce5 commit e954e46

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

packages/enzyme/src/ReactWrapper.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,8 @@ class ReactWrapper {
350350
*/
351351
matchesElement(node) {
352352
return this.single('matchesElement', () => {
353-
const rstNode = getAdapter().elementToNode(node);
353+
const adapter = getAdapter(this[OPTIONS]);
354+
const rstNode = adapter.elementToNode(node);
354355
return nodeMatches(rstNode, this.getNodeInternal(), (a, b) => a <= b);
355356
});
356357
}

packages/enzyme/src/ShallowWrapper.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,8 @@ class ShallowWrapper {
533533
* @returns {Boolean}
534534
*/
535535
containsMatchingElement(node) {
536-
const rstNode = getAdapter().elementToNode(node);
536+
const adapter = getAdapter(this[OPTIONS]);
537+
const rstNode = adapter.elementToNode(node);
537538
const predicate = other => nodeMatches(rstNode, other, (a, b) => a <= b);
538539
return findWhereUnwrapped(this, predicate).length > 0;
539540
}
@@ -623,7 +624,8 @@ class ShallowWrapper {
623624
*/
624625
matchesElement(node) {
625626
return this.single('matchesElement', () => {
626-
const rstNode = getAdapter().elementToNode(node);
627+
const adapter = getAdapter(this[OPTIONS]);
628+
const rstNode = adapter.elementToNode(node);
627629
return nodeMatches(rstNode, this.getNodeInternal(), (a, b) => a <= b);
628630
});
629631
}

0 commit comments

Comments
 (0)