diff --git a/scripts/fiber/tests-failing.txt b/scripts/fiber/tests-failing.txt index 36f8480baf36f..31014dfe0a716 100644 --- a/scripts/fiber/tests-failing.txt +++ b/scripts/fiber/tests-failing.txt @@ -58,6 +58,9 @@ src/renderers/shared/hooks/__tests__/ReactHostOperationHistoryHook-test.js src/renderers/shared/shared/__tests__/ReactComponentLifeCycle-test.js * should carry through each of the phases of setup +src/renderers/shared/shared/__tests__/ReactCompositeComponentState-test.js +* should merge state when sCU returns false + src/renderers/shared/shared/__tests__/ReactEmptyComponent-test.js * should still throw when rendering to undefined diff --git a/src/renderers/shared/shared/__tests__/ReactCompositeComponentState-test.js b/src/renderers/shared/shared/__tests__/ReactCompositeComponentState-test.js index d9e884cf89181..bb6fc95baf5dc 100644 --- a/src/renderers/shared/shared/__tests__/ReactCompositeComponentState-test.js +++ b/src/renderers/shared/shared/__tests__/ReactCompositeComponentState-test.js @@ -385,4 +385,32 @@ describe('ReactCompositeComponent-state', () => { 'child render two', ]); }); + + it('should merge state when sCU returns false', function() { + const log = []; + class Test extends React.Component { + state = {a: 0}; + render() { + return null; + } + shouldComponentUpdate(nextProps, nextState) { + log.push( + 'scu from ' + Object.keys(this.state) + + ' to ' + Object.keys(nextState) + ); + return false; + } + } + + const container = document.createElement('div'); + const test = ReactDOM.render(, container); + test.setState({b: 0}); + expect(log.length).toBe(1); + test.setState({c: 0}); + expect(log.length).toBe(2); + expect(log).toEqual([ + 'scu from a to a,b', + 'scu from a,b to a,b,c', + ]); + }); });