Skip to content

Commit fc16611

Browse files
committed
Apply patch from enzymejs/enzyme#2189 (comment): support .contextType on components
1 parent 8ebe478 commit fc16611

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-shallow-renderer",
3-
"version": "16.14.1",
3+
"version": "16.14.2",
44
"description": "React package for shallow rendering.",
55
"main": "index.js",
66
"repository": "https://github.com/NMinhNguyen/react-shallow-renderer.git",

Diff for: src/ReactShallowRenderer.js

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

501501
this._rendering = true;
502502
this._element = element;
503-
this._context = getMaskedContext(elementType.contextTypes, context);
503+
this._context = element.contextType
504+
? context
505+
: getMaskedContext(elementType.contextTypes, context);
504506

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

0 commit comments

Comments
 (0)