Skip to content

Commit 7986308

Browse files
committed
[Refactor] ReactWrapper/ShallowWrapper: ensure calling an adapter‘s nodeToElement preserves the receiver
1 parent 65881b2 commit 7986308

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/enzyme/src/ReactWrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ class ReactWrapper {
186186
* @return {Array<ReactElement>}
187187
*/
188188
getElements() {
189-
return this[NODES].map(getAdapter(this[OPTIONS]).nodeToElement);
189+
return this[NODES].map(n => getAdapter(this[OPTIONS]).nodeToElement(n));
190190
}
191191

192192
// eslint-disable-next-line class-methods-use-this

packages/enzyme/src/ShallowWrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ class ShallowWrapper {
480480
* @return {Array<ReactElement>}
481481
*/
482482
getElements() {
483-
return this.getNodesInternal().map(getAdapter(this[OPTIONS]).nodeToElement);
483+
return this.getNodesInternal().map(n => getAdapter(this[OPTIONS]).nodeToElement(n));
484484
}
485485

486486
// eslint-disable-next-line class-methods-use-this

0 commit comments

Comments
 (0)