Skip to content

Commit

Permalink
Added createReactClass test for static gDSFP
Browse files Browse the repository at this point in the history
  • Loading branch information
bvaughn committed Jan 18, 2018
1 parent b699543 commit 68f2fe7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/react/src/__tests__/createReactClassIntegration-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -497,4 +497,22 @@ describe('create-react-class-integration', () => {
'after unmount: false',
]);
});

it('should support the new static getDerivedStateFromProps method', () => {
let instance;
const Component = createReactClass({
statics: {
getDerivedStateFromProps: function() {
return {foo: 'bar'};
},
},

render: function() {
instance = this;
return null;
},
});
ReactDOM.render(<Component />, document.createElement('div'));
expect(instance.state.foo).toBe('bar');
});
});

0 comments on commit 68f2fe7

Please sign in to comment.