diff --git a/packages/component-test-utils-react/src/shallow.js b/packages/component-test-utils-react/src/shallow.js index 12773ff..a0ca86f 100644 --- a/packages/component-test-utils-react/src/shallow.js +++ b/packages/component-test-utils-react/src/shallow.js @@ -25,7 +25,7 @@ class ShallowRender { this._render(); } - _render(customProps) { + _render(customProps, forceUpdate) { let firstRender = false; const prevDispatcher = ReactCurrentDispatcher.current; @@ -65,6 +65,7 @@ class ShallowRender { this._instance.props = props; if ( + !forceUpdate && !firstRender && typeof this._instance.shouldComponentUpdate === 'function' && !this._instance.shouldComponentUpdate( diff --git a/packages/component-test-utils-react/src/shallow.spec.js b/packages/component-test-utils-react/src/shallow.spec.js index f56b10b..290020b 100644 --- a/packages/component-test-utils-react/src/shallow.spec.js +++ b/packages/component-test-utils-react/src/shallow.spec.js @@ -1036,7 +1036,28 @@ describe('react shallow render', () => { describe('componentDidCatch', () => { // TODO }); - describe('forceUpdate', () => {}); + describe('forceUpdate', () => { + it('should trigger a render whenever shouldComponentUpdate return false', () => { + class Component extends React.Component { + shouldComponentUpdate() { + return false; + } + + render() { + return ( +