Skip to content

Commit e907f85

Browse files
committed
Add passing test from #429
1 parent e2df051 commit e907f85

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/components/connect.spec.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff 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
})

0 commit comments

Comments
 (0)