Skip to content

Commit

Permalink
Fix componentWillUnmount test case in isMounted tests and add mixin t…
Browse files Browse the repository at this point in the history
…ests
  • Loading branch information
mridgway committed Jun 12, 2017
1 parent 35ae38d commit 6a16251
Showing 1 changed file with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,25 @@ describe('create-react-class-integration', () => {
var instance;
var Component = createReactClass({
displayName: 'MyComponent',
mixins: [
{
componentWillMount() {
this.log('mixin.componentWillMount');
},
componentDidMount() {
this.log('mixin.componentDidMount');
},
componentWillUpdate() {
this.log('mixin.componentWillUpdate');
},
componentDidUpdate() {
this.log('mixin.componentDidUpdate');
},
componentWillUnmount() {
this.log('mixin.componentWillUnmount');
},
},
],
log(name) {
ops.push(`${name}: ${this.isMounted()}`);
},
Expand Down Expand Up @@ -407,13 +426,18 @@ describe('create-react-class-integration', () => {
instance.log('after unmount');
expect(ops).toEqual([
'getInitialState: false',
'mixin.componentWillMount: false',
'componentWillMount: false',
'render: false',
'mixin.componentDidMount: true',
'componentDidMount: true',
'mixin.componentWillUpdate: true',
'componentWillUpdate: true',
'render: true',
'mixin.componentDidUpdate: true',
'componentDidUpdate: true',
'componentWillUnmount: false',
'mixin.componentWillUnmount: true',
'componentWillUnmount: true',
'after unmount: false',
]);

Expand Down

0 comments on commit 6a16251

Please sign in to comment.