File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1875,5 +1875,28 @@ describe('React', () => {
18751875 expect ( MyComponent . displayName ) . toEqual ( 'Custom(MyComponent)' )
18761876 } )
18771877
1878+ it ( 'should update impure components whenever the state of the store changes' , ( ) => {
1879+ const store = createStore ( ( ) => ( { } ) )
1880+ let renderCount = 0
1881+
1882+ @connect ( ( ) => ( { } ) , null , null , { pure : false } )
1883+ class ImpureComponent extends React . Component {
1884+ render ( ) {
1885+ ++ renderCount
1886+ return < div />
1887+ }
1888+ }
1889+
1890+ TestUtils . renderIntoDocument (
1891+ < ProviderMock store = { store } >
1892+ < ImpureComponent />
1893+ </ ProviderMock >
1894+ )
1895+
1896+ const rendersBeforeStateChange = renderCount
1897+ store . dispatch ( { type : 'ACTION' } )
1898+ expect ( renderCount ) . toBe ( rendersBeforeStateChange + 1 )
1899+ } )
18781900 } )
1901+
18791902} )
You can’t perform that action at this time.
0 commit comments