Skip to content

Commit

Permalink
Added inline note to createReactClassIntegration-test about why lifec…
Browse files Browse the repository at this point in the history
…ycles hooks not migrated
  • Loading branch information
bvaughn committed Jan 16, 2018
1 parent f0e6f62 commit d9e0d48
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/react/src/__tests__/createReactClassIntegration-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,25 @@ describe('create-react-class-integration', () => {

const container = document.createElement('div');

expect(() => ReactDOM.render(<Component />, container)).toWarnDev(
// Note: The below lifecycle warnings are unavoidable for now,
// Until create-react-class recognizes the unsafe_* methods.
// (If we try to use them before them, it will error because
// we are defining the same method twice.)
expect(() => ReactDOM.render(<Component />, container)).toWarnDev([
'Warning: MyComponent: isMounted is deprecated. Instead, make sure to ' +
'clean up subscriptions and pending requests in componentWillUnmount ' +
'to prevent memory leaks.',
'Warning: MyComponent: componentWillMount() is deprecated and will be ' +
'removed in the next major version. Please use ' +
'unsafe_componentWillMount() instead.',
]);

expect(() => ReactDOM.render(<Component />, container)).toWarnDev(
'Warning: MyComponent: componentWillUpdate() is deprecated and will be ' +
'removed in the next major version. Please use ' +
'unsafe_componentWillUpdate() instead.'
);

ReactDOM.render(<Component />, container);
ReactDOM.unmountComponentAtNode(container);
instance.log('after unmount');
expect(ops).toEqual([
Expand Down

0 comments on commit d9e0d48

Please sign in to comment.