Skip to content

Commit

Permalink
Add passing test from reduxjs#429
Browse files Browse the repository at this point in the history
  • Loading branch information
jimbolla committed Jul 16, 2016
1 parent e2df051 commit e907f85
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/components/connect.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1875,5 +1875,28 @@ describe('React', () => {
expect(MyComponent.displayName).toEqual('Custom(MyComponent)')
})

it('should update impure components whenever the state of the store changes', () => {
const store = createStore(() => ({}))
let renderCount = 0

@connect(() => ({}), null, null, { pure: false })
class ImpureComponent extends React.Component {
render() {
++renderCount
return <div />
}
}

TestUtils.renderIntoDocument(
<ProviderMock store={store}>
<ImpureComponent />
</ProviderMock>
)

const rendersBeforeStateChange = renderCount
store.dispatch({ type: 'ACTION' })
expect(renderCount).toBe(rendersBeforeStateChange + 1)
})
})

})

0 comments on commit e907f85

Please sign in to comment.