Skip to content

Commit 68fe402

Browse files
unverbrauchtljharb
authored andcommitted
Apply patch from enzymejs/enzyme#2189 (comment): support .contextType on components
1 parent 802c735 commit 68fe402

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: src/ReactShallowRenderer.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,9 @@ See https://fb.me/react-invalid-hook-call for tips about how to debug and fix th
515515

516516
this._rendering = true;
517517
this._element = element;
518-
this._context = getMaskedContext(elementType.contextTypes, context);
518+
this._context = element.contextType
519+
? context
520+
: getMaskedContext(elementType.contextTypes, context);
519521

520522
// Inner memo component props aren't currently validated in createElement.
521523
let prevGetStack;

0 commit comments

Comments
 (0)