enzyme-after-update
A helper for waiting for an update on an Enzyme ReactWrapper before performing an assertion.
enzyme-after-update
is a testing helper that is useful when your React components update asyncronously after an action. It returns a promise that waits for the React Component's componentDidUpdate method to be called before resolving. This is useful for making assertions about the state of a component after an asyncronous update has occured.
API
afterUpdate(reactWrapper)
Returns a promise that waits for the provided
reactWrapper
(an instance of an Enzyme ReactWrapper class) to call componentDidUpdate
.
Example
const React = ;const expect = expect;const mount = mount;const afterUpdate = ;const ActivateFrom = ; ;
Release History
- 2016-10-28 - v1.0.0 - initial release
- 2016-10-31 - v1.1.0 - afterUpdate can now be used with non-root ReactWrappers.
- 2016-10-31 - v1.1.1 - Improve Readme