diff --git a/packages/enzyme/src/ReactWrapper.js b/packages/enzyme/src/ReactWrapper.js index 0417fe462..21a54a4ca 100644 --- a/packages/enzyme/src/ReactWrapper.js +++ b/packages/enzyme/src/ReactWrapper.js @@ -350,7 +350,8 @@ class ReactWrapper { */ matchesElement(node) { return this.single('matchesElement', () => { - const rstNode = getAdapter().elementToNode(node); + const adapter = getAdapter(this[OPTIONS]); + const rstNode = adapter.elementToNode(node); return nodeMatches(rstNode, this.getNodeInternal(), (a, b) => a <= b); }); } diff --git a/packages/enzyme/src/ShallowWrapper.js b/packages/enzyme/src/ShallowWrapper.js index 66dbd97fb..77324b031 100644 --- a/packages/enzyme/src/ShallowWrapper.js +++ b/packages/enzyme/src/ShallowWrapper.js @@ -533,7 +533,8 @@ class ShallowWrapper { * @returns {Boolean} */ containsMatchingElement(node) { - const rstNode = getAdapter().elementToNode(node); + const adapter = getAdapter(this[OPTIONS]); + const rstNode = adapter.elementToNode(node); const predicate = other => nodeMatches(rstNode, other, (a, b) => a <= b); return findWhereUnwrapped(this, predicate).length > 0; } @@ -623,7 +624,8 @@ class ShallowWrapper { */ matchesElement(node) { return this.single('matchesElement', () => { - const rstNode = getAdapter().elementToNode(node); + const adapter = getAdapter(this[OPTIONS]); + const rstNode = adapter.elementToNode(node); return nodeMatches(rstNode, this.getNodeInternal(), (a, b) => a <= b); }); }