File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
enzyme-adapter-react-15.4/src
enzyme-adapter-react-15/src Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ import {
1818} from 'enzyme-adapter-utils' ;
1919
2020const MINOR_VERSION = React . version . split ( '.' ) [ 1 ] ;
21- const CALLING_SETSTATE_CALLBACK_WITH_UNDEFINED = MINOR_VERSION >= 4 ;
2221
2322function compositeTypeToNodeType ( type ) {
2423 switch ( type ) {
@@ -257,7 +256,8 @@ class ReactFifteenFourAdapter extends EnzymeAdapter {
257256 }
258257
259258 invokeSetStateCallback ( instance , callback ) {
260- if ( CALLING_SETSTATE_CALLBACK_WITH_UNDEFINED ) {
259+ // React in <= 15.3, and >= 16 pass undefined to a setState callback
260+ if ( MINOR_VERSION >= 4 ) {
261261 callback . call ( instance , undefined ) ;
262262 } else {
263263 callback . call ( instance ) ;
Original file line number Diff line number Diff line change @@ -255,6 +255,7 @@ class ReactFifteenAdapter extends EnzymeAdapter {
255255 }
256256
257257 invokeSetStateCallback ( instance , callback ) {
258+ // React in <= 15.3, and >= 16 pass undefined to a setState callback
258259 callback . call ( instance , undefined ) ;
259260 }
260261}
You can’t perform that action at this time.
0 commit comments