Add test for unmount/remount in a single batch (#8470)
Fails in Fiber.
Ben Alpert committed
Dec 1, 2016 at 14:19 UTC
361ce5c00bd39942a7417dd635503e59e058267b
2 files changed
+11
scripts/fiber/tests-failing.txt
+1
@@ -115,6 +115,7 @@ src/renderers/shared/shared/__tests__/ReactUpdates-test.js
115
* throws in setState if the update callback is not a function
116
* throws in replaceState if the update callback is not a function
117
* throws in forceUpdate if the update callback is not a function
118
+* unmounts and remounts a root in the same batch
119
120
src/renderers/shared/shared/__tests__/refs-test.js
121
* Should increase refs with an increase in divs
src/renderers/shared/shared/__tests__/ReactUpdates-test.js
+10
@@ -1081,4 +1081,14 @@ describe('ReactUpdates', () => {
1081
});
1082
expect(result).toEqual(42);
1083
});
1084
+
1085
+ it('unmounts and remounts a root in the same batch', () => {
1086
+ var container = document.createElement('div');
1087
+ ReactDOM.render(<span>a</span>, container);
1088
+ ReactDOM.unstable_batchedUpdates(function() {
1089
+ ReactDOM.unmountComponentAtNode(container);
1090
+ ReactDOM.render(<span>b</span>, container);
1091
+ });
1092
+ expect(container.textContent).toBe('b');
1093
+ });
1094
});