Skip to content

Commit

Permalink
Use elementType in _updateClassComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Dail committed Feb 11, 2019
1 parent 7d31954 commit 19561b6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/react-test-renderer/src/ReactShallowRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ class ReactShallowRenderer {
// In order to support react-lifecycles-compat polyfilled components,
// Unsafe lifecycles should not be invoked for components using the new APIs.
if (
typeof element.type.getDerivedStateFromProps !== 'function' &&
typeof elementType.getDerivedStateFromProps !== 'function' &&
typeof this._instance.getSnapshotBeforeUpdate !== 'function'
) {
if (typeof this._instance.componentWillReceiveProps === 'function') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ describe('ReactShallowRenderer', () => {
expect(logs).toEqual([undefined]);
});

it('works with memo', () => {
it('should handle memo', () => {
const Foo = () => {
<div>Foo</div>;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1539,13 +1539,4 @@ describe('ReactShallowRendererMemo', () => {
shallowRenderer.render(<Foo foo="bar" />);
expect(logs).toEqual([undefined]);
});

it('should handle memo', () => {
const Foo = () => {
<div>Foo</div>;
};
const MemoFoo = React.memo(Foo);
const shallowRenderer = createRenderer();
shallowRenderer.render(<MemoFoo />);
});
});

0 comments on commit 19561b6

Please sign in to comment.