diff --git a/scripts/fiber/tests-failing.txt b/scripts/fiber/tests-failing.txt index a41b7230a1ec..a070cdb464ab 100644 --- a/scripts/fiber/tests-failing.txt +++ b/scripts/fiber/tests-failing.txt @@ -567,20 +567,9 @@ src/renderers/shared/stack/reconciler/__tests__/ReactStatelessComponent-test.js * should warn when using non-React functions in JSX src/renderers/shared/stack/reconciler/__tests__/ReactUpdates-test.js -* should batch state when updating state twice -* should batch state when updating two different state keys -* should batch state and props together -* should batch parent/child state updates together -* should batch child/parent state updates together -* should support chained state updates -* should batch forceUpdate together -* should update children even if parent blocks updates -* should flow updates correctly * should share reconcile transaction across different roots * should queue mount-ready handlers across different roots -* should flush updates in the correct order across roots * should queue updates from during mount -* does not call render after a component as been deleted * marks top-level updates * throws in setState if the update callback is not a function * throws in replaceState if the update callback is not a function diff --git a/scripts/fiber/tests-passing.txt b/scripts/fiber/tests-passing.txt index b554584d0163..0508624f42c5 100644 --- a/scripts/fiber/tests-passing.txt +++ b/scripts/fiber/tests-passing.txt @@ -1155,10 +1155,21 @@ src/renderers/shared/stack/reconciler/__tests__/ReactStatelessComponent-test.js * should allow simple functions to return false src/renderers/shared/stack/reconciler/__tests__/ReactUpdates-test.js +* should batch state when updating state twice +* should batch state when updating two different state keys +* should batch state and props together +* should batch parent/child state updates together +* should batch child/parent state updates together +* should support chained state updates +* should batch forceUpdate together +* should update children even if parent blocks updates * should not reconcile children passed via props +* should flow updates correctly * should flush updates in the correct order +* should flush updates in the correct order across roots * should queue nested updates * calls componentWillReceiveProps setState callback properly +* does not call render after a component as been deleted * does not update one component twice in a batch (#2410) * does not update one component twice in a batch (#6371) * unstable_batchedUpdates should return value from a callback diff --git a/src/renderers/shared/stack/reconciler/__tests__/ReactCompositeComponent-test.js b/src/renderers/shared/stack/reconciler/__tests__/ReactCompositeComponent-test.js index d62d4a332ec1..16c44dfbf6a2 100644 --- a/src/renderers/shared/stack/reconciler/__tests__/ReactCompositeComponent-test.js +++ b/src/renderers/shared/stack/reconciler/__tests__/ReactCompositeComponent-test.js @@ -19,7 +19,6 @@ var ReactCurrentOwner; var ReactPropTypes; var ReactServerRendering; var ReactTestUtils; -var ReactUpdates; describe('ReactCompositeComponent', () => { @@ -31,7 +30,6 @@ describe('ReactCompositeComponent', () => { ReactPropTypes = require('ReactPropTypes'); ReactTestUtils = require('ReactTestUtils'); ReactServerRendering = require('ReactServerRendering'); - ReactUpdates = require('ReactUpdates'); MorphingComponent = class extends React.Component { state = {activated: false}; @@ -813,7 +811,7 @@ describe('ReactCompositeComponent', () => { expect(childInstance).toBeNull(); expect(parentInstance.state.flag).toBe(false); - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { parentInstance.setState({flag: true}); }); expect(parentInstance.state.flag).toBe(true); @@ -1209,7 +1207,7 @@ describe('ReactCompositeComponent', () => { // When more than one state update is enqueued, we have the same behavior var fifthState = new NotActuallyImmutable('fifth'); - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { moo.setState({str: 'fourth'}); moo.replaceState(fifthState); }); @@ -1217,7 +1215,7 @@ describe('ReactCompositeComponent', () => { // When more than one state update is enqueued, we have the same behavior var sixthState = new NotActuallyImmutable('sixth'); - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { moo.replaceState(sixthState); moo.setState({str: 'seventh'}); }); diff --git a/src/renderers/shared/stack/reconciler/__tests__/ReactUpdates-test.js b/src/renderers/shared/stack/reconciler/__tests__/ReactUpdates-test.js index 9d8c6a6e84a6..5812ce35c06d 100644 --- a/src/renderers/shared/stack/reconciler/__tests__/ReactUpdates-test.js +++ b/src/renderers/shared/stack/reconciler/__tests__/ReactUpdates-test.js @@ -42,7 +42,7 @@ describe('ReactUpdates', () => { var instance = ReactTestUtils.renderIntoDocument(); expect(instance.state.x).toBe(0); - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { instance.setState({x: 1}); instance.setState({x: 2}); expect(instance.state.x).toBe(0); @@ -72,7 +72,7 @@ describe('ReactUpdates', () => { expect(instance.state.x).toBe(0); expect(instance.state.y).toBe(0); - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { instance.setState({x: 1}); instance.setState({y: 2}); expect(instance.state.x).toBe(0); @@ -105,7 +105,7 @@ describe('ReactUpdates', () => { expect(instance.props.x).toBe(0); expect(instance.state.y).toBe(0); - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { ReactDOM.render(, container); instance.setState({y: 2}); expect(instance.props.x).toBe(0); @@ -152,7 +152,7 @@ describe('ReactUpdates', () => { expect(instance.state.x).toBe(0); expect(child.state.y).toBe(0); - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { instance.setState({x: 1}); child.setState({y: 2}); expect(instance.state.x).toBe(0); @@ -201,7 +201,7 @@ describe('ReactUpdates', () => { expect(instance.state.x).toBe(0); expect(child.state.y).toBe(0); - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { child.setState({y: 2}); instance.setState({x: 1}); expect(instance.state.x).toBe(0); @@ -237,7 +237,7 @@ describe('ReactUpdates', () => { expect(instance.state.x).toBe(0); var innerCallbackRun = false; - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { instance.setState({x: 1}, function() { instance.setState({x: 2}, function() { expect(this).toBe(instance); @@ -281,7 +281,7 @@ describe('ReactUpdates', () => { expect(instance.state.x).toBe(0); var callbacksRun = 0; - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { instance.setState({x: 1}, function() { callbacksRun++; }); @@ -330,14 +330,14 @@ describe('ReactUpdates', () => { expect(parentRenderCount).toBe(1); expect(childRenderCount).toBe(1); - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { instance.setState({x: 1}); }); expect(parentRenderCount).toBe(1); expect(childRenderCount).toBe(1); - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { instance.refs.child.setState({x: 1}); }); @@ -465,7 +465,7 @@ describe('ReactUpdates', () => { function testUpdates(components, desiredWillUpdates, desiredDidUpdates) { var i; - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { for (i = 0; i < components.length; i++) { triggerUpdate(components[i]); } @@ -475,7 +475,7 @@ describe('ReactUpdates', () => { // Try them in reverse order - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { for (i = components.length - 1; i >= 0; i--) { triggerUpdate(components[i]); } @@ -519,7 +519,7 @@ describe('ReactUpdates', () => { var containerB = document.createElement('div'); // Initial renders aren't batched together yet... - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { ReactDOM.render(, containerA); ReactDOM.render(, containerB); }); @@ -527,7 +527,7 @@ describe('ReactUpdates', () => { // ...but updates are! Here only one more transaction is used, which means // we only have to initialize and close the wrappers once. - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { ReactDOM.render(, containerA); ReactDOM.render(, containerB); }); @@ -568,7 +568,7 @@ describe('ReactUpdates', () => { a = ReactTestUtils.renderIntoDocument(); b = ReactTestUtils.renderIntoDocument(); - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { a.setState({x: 1}); b.setState({x: 1}); }); @@ -679,7 +679,7 @@ describe('ReactUpdates', () => { expect(updates).toEqual([0, 1, 2]); - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { // Simulate update on each component from top to bottom. instances.forEach(function(instance) { instance.forceUpdate(); @@ -771,7 +771,7 @@ describe('ReactUpdates', () => { } } - ReactUpdates.batchedUpdates(function() { + ReactDOM.unstable_batchedUpdates(function() { ReactTestUtils.renderIntoDocument(