Skip to content

Commit

Permalink
Fix a test and comment for componentDidUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
koba04 committed Oct 18, 2017
1 parent ce39a28 commit 7bf02a3
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/enzyme-test-suite/test/ShallowWrapper-spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1026,7 +1026,7 @@ describe('shallow', () => {
expect(wrapper.first('div').text()).to.equal('yolo');
});

it('should call componentWillReceiveProps, shouldComponentUpdate and componentWillUpdate with merged newProps', () => {
it('should call componentWillReceiveProps, shouldComponentUpdate and componentWillUpdate and componentDidUpdate with merged newProps', () => {
const spy = sinon.spy();

class Foo extends React.Component {
Expand All @@ -1040,6 +1040,9 @@ describe('shallow', () => {
componentWillUpdate(nextProps) {
spy('componentWillUpdate', this.props, nextProps);
}
componentDidUpdate(prevProps) {
spy('componentDidUpdate', prevProps, this.props);
}
render() {
return (
<div />
Expand Down Expand Up @@ -1067,6 +1070,11 @@ describe('shallow', () => {
{ a: 'a', b: 'b' },
{ a: 'a', b: 'c', d: 'e' },
],
[
'componentDidUpdate',
{ a: 'a', b: 'b' },
{ a: 'a', b: 'c', d: 'e' },
],
]);
});

Expand Down Expand Up @@ -3096,7 +3104,7 @@ describe('shallow', () => {
]);
});

// componentDidUpdate does not seem to get called in react 16 beta.
// componentDidUpdate is not called in react 16
itIf(REACT16, 'calls expected methods for setState', () => {
wrapper.setState({ bar: 'bar' });
expect(spy.args).to.deep.equal([
Expand Down

0 comments on commit 7bf02a3

Please sign in to comment.