Skip to content

Commit

Permalink
Apply patch from enzymejs/enzyme#2189 (comment): support .contextType…
Browse files Browse the repository at this point in the history
… on components
  • Loading branch information
unverbraucht authored and pablopalacios committed Oct 6, 2022
1 parent 802c735 commit 6e63b07
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/ReactShallowRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,9 @@ See https://fb.me/react-invalid-hook-call for tips about how to debug and fix th

this._rendering = true;
this._element = element;
this._context = getMaskedContext(elementType.contextTypes, context);
this._context = element.contextType
? context
: getMaskedContext(elementType.contextTypes, context);

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

0 comments on commit 6e63b07

Please sign in to comment.