From 3af93a4240687eb16b816c343f8ba1342e6edcb8 Mon Sep 17 00:00:00 2001 From: Michael Ridgway Date: Mon, 8 May 2017 18:32:52 -0700 Subject: [PATCH] Fix componentWillUnmount test case in isMounted tests and add mixin tests --- .../create-react-class-integration-test.js | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/isomorphic/classic/class/__tests__/create-react-class-integration-test.js b/src/isomorphic/classic/class/__tests__/create-react-class-integration-test.js index 2c5cb6fcd2dbe..33a50e90eac10 100644 --- a/src/isomorphic/classic/class/__tests__/create-react-class-integration-test.js +++ b/src/isomorphic/classic/class/__tests__/create-react-class-integration-test.js @@ -372,6 +372,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()}`); }, @@ -408,13 +427,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', ]);