File tree 1 file changed +24
-0
lines changed 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -2125,5 +2125,29 @@ describe('React', () => {
2125
2125
expect ( error ) . toInclude ( 'InvalidMerge' )
2126
2126
} )
2127
2127
2128
+ it ( 'should notify nested components through a blocking component' , ( ) => {
2129
+ @connect ( state => ( { count : state } ) )
2130
+ class Parent extends Component {
2131
+ render ( ) { return < BlockUpdates > < Child /> </ BlockUpdates > }
2132
+ }
2133
+
2134
+ class BlockUpdates extends Component {
2135
+ shouldComponentUpdate ( ) { return false ; }
2136
+ render ( ) { return this . props . children ; }
2137
+ }
2138
+
2139
+ const mapStateToProps = expect . createSpy ( ) . andCall ( state => ( { count : state } ) )
2140
+ @connect ( mapStateToProps )
2141
+ class Child extends Component {
2142
+ render ( ) { return < div > { this . props . count } </ div > }
2143
+ }
2144
+
2145
+ const store = createStore ( ( state = 0 , action ) => ( action . type === 'INC' ? state + 1 : state ) )
2146
+ TestUtils . renderIntoDocument ( < ProviderMock store = { store } > < Parent /> </ ProviderMock > )
2147
+
2148
+ expect ( mapStateToProps . calls . length ) . toBe ( 1 )
2149
+ store . dispatch ( { type : 'INC' } )
2150
+ expect ( mapStateToProps . calls . length ) . toBe ( 2 )
2151
+ } )
2128
2152
} )
2129
2153
} )
You can’t perform that action at this time.
0 commit comments