diff --git a/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.internal.js b/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.internal.js index 84cfb049f0a01..e6c08193a8175 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.internal.js +++ b/packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.internal.js @@ -14,7 +14,7 @@ let ReactFeatureFlags = require('shared/ReactFeatureFlags'); let ReactDOM; -const ConcurrentMode = React.unstable_ConcurrentMode; +const ConcurrentMode = React.ConcurrentMode; const setUntrackedInputValue = Object.getOwnPropertyDescriptor( HTMLInputElement.prototype, @@ -163,7 +163,7 @@ describe('ReactDOMFiberAsync', () => { }); it('createRoot makes the entire tree async', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); root.render(
Hi
); expect(container.textContent).toEqual(''); jest.runAllTimers(); @@ -185,7 +185,7 @@ describe('ReactDOMFiberAsync', () => { } } - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); root.render(); expect(container.textContent).toEqual(''); jest.runAllTimers(); diff --git a/packages/react-dom/src/__tests__/ReactDOMRoot-test.js b/packages/react-dom/src/__tests__/ReactDOMRoot-test.js index 4157e64b46cad..acebfe6fda5ad 100644 --- a/packages/react-dom/src/__tests__/ReactDOMRoot-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMRoot-test.js @@ -12,7 +12,7 @@ let React = require('react'); let ReactDOM = require('react-dom'); let ReactDOMServer = require('react-dom/server'); -let ConcurrentMode = React.unstable_ConcurrentMode; +let ConcurrentMode = React.ConcurrentMode; describe('ReactDOMRoot', () => { let container; @@ -63,18 +63,18 @@ describe('ReactDOMRoot', () => { React = require('react'); ReactDOM = require('react-dom'); ReactDOMServer = require('react-dom/server'); - ConcurrentMode = React.unstable_ConcurrentMode; + ConcurrentMode = React.ConcurrentMode; }); it('renders children', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); root.render(
Hi
); jest.runAllTimers(); expect(container.textContent).toEqual('Hi'); }); it('unmounts children', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); root.render(
Hi
); jest.runAllTimers(); expect(container.textContent).toEqual('Hi'); @@ -84,7 +84,7 @@ describe('ReactDOMRoot', () => { }); it('`root.render` returns a thenable work object', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); const work = root.render(Hi); let ops = []; work.then(() => { @@ -102,7 +102,7 @@ describe('ReactDOMRoot', () => { }); it('resolves `work.then` callback synchronously if the work already committed', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); const work = root.render(Hi); jest.runAllTimers(); let ops = []; @@ -126,7 +126,7 @@ describe('ReactDOMRoot', () => { // Does not hydrate by default const container1 = document.createElement('div'); container1.innerHTML = markup; - const root1 = ReactDOM.unstable_createRoot(container1); + const root1 = ReactDOM.createRoot(container1); root1.render(
@@ -137,7 +137,7 @@ describe('ReactDOMRoot', () => { // Accepts `hydrate` option const container2 = document.createElement('div'); container2.innerHTML = markup; - const root2 = ReactDOM.unstable_createRoot(container2, {hydrate: true}); + const root2 = ReactDOM.createRoot(container2, {hydrate: true}); root2.render(
@@ -150,7 +150,7 @@ describe('ReactDOMRoot', () => { it('does not clear existing children', async () => { container.innerHTML = '
a
b
'; - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); root.render(
c @@ -170,7 +170,7 @@ describe('ReactDOMRoot', () => { }); it('can defer a commit by batching it', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); const batch = root.createBatch(); batch.render(
Hi
); // Hasn't committed yet @@ -193,7 +193,7 @@ describe('ReactDOMRoot', () => { } } - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); const batch = root.createBatch(); batch.render( @@ -226,7 +226,7 @@ describe('ReactDOMRoot', () => { ops.push('Foo'); return props.children; } - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); const batch = root.createBatch(); batch.render(Hi); // Flush all async work. @@ -244,7 +244,7 @@ describe('ReactDOMRoot', () => { }); it('can wait for a batch to finish', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); const batch = root.createBatch(); batch.render(Foo); @@ -266,7 +266,7 @@ describe('ReactDOMRoot', () => { }); it('`batch.render` returns a thenable work object', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); const batch = root.createBatch(); const work = batch.render('Hi'); let ops = []; @@ -285,7 +285,7 @@ describe('ReactDOMRoot', () => { }); it('can commit an empty batch', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); root.render(1); advanceCurrentTime(2000); @@ -302,7 +302,7 @@ describe('ReactDOMRoot', () => { it('two batches created simultaneously are committed separately', () => { // (In other words, they have distinct expiration times) - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); const batch1 = root.createBatch(); batch1.render(1); const batch2 = root.createBatch(); @@ -318,7 +318,7 @@ describe('ReactDOMRoot', () => { }); it('commits an earlier batch without committing a later batch', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); const batch1 = root.createBatch(); batch1.render(1); @@ -337,7 +337,7 @@ describe('ReactDOMRoot', () => { }); it('commits a later batch without committing an earlier batch', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); const batch1 = root.createBatch(); batch1.render(1); @@ -357,7 +357,7 @@ describe('ReactDOMRoot', () => { }); it('handles fatal errors triggered by batch.commit()', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); const batch = root.createBatch(); const InvalidType = undefined; expect(() => batch.render()).toWarnDev( @@ -369,9 +369,7 @@ describe('ReactDOMRoot', () => { it('throws a good message on invalid containers', () => { expect(() => { - ReactDOM.unstable_createRoot(
Hi
); - }).toThrow( - 'unstable_createRoot(...): Target container is not a DOM element.', - ); + ReactDOM.createRoot(
Hi
); + }).toThrow('createRoot(...): Target container is not a DOM element.'); }); }); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationModes-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationModes-test.js index 3a4abc6abb249..22848294f9546 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationModes-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationModes-test.js @@ -104,12 +104,12 @@ describe('ReactDOMServerIntegration', () => { }); }); - describe('React.unstable_ConcurrentMode', () => { + describe('React.ConcurrentMode', () => { itRenders('an concurrent mode with one child', async render => { let e = await render( - +
text1
-
, + , ); let parent = e.parentNode; expect(parent.childNodes[0].tagName).toBe('DIV'); @@ -121,19 +121,19 @@ describe('ReactDOMServerIntegration', () => { }; let Footer = props => { return ( - +

footer

about

-
+ ); }; let e = await render( - +
text1
text2
- , + , ); let parent = e.parentNode; expect(parent.childNodes[0].tagName).toBe('DIV'); @@ -145,21 +145,21 @@ describe('ReactDOMServerIntegration', () => { itRenders('a nested concurrent mode', async render => { let e = await render( - - + +
text1
-
+ text2 - - - + + + {null}

- + {false} - - - , + + + , ); let parent = e.parentNode; expect(parent.childNodes[0].tagName).toBe('DIV'); @@ -168,7 +168,7 @@ describe('ReactDOMServerIntegration', () => { }); itRenders('an empty concurrent mode', async render => { - expect(await render()).toBe(null); + expect(await render()).toBe(null); }); }); }); diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSpecialTypes-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSpecialTypes-test.js index ede1126863f5f..b56d36b626a76 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSpecialTypes-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationSpecialTypes-test.js @@ -73,9 +73,9 @@ describe('ReactDOMServerIntegration', () => { itRenders('a Profiler component and its children', async render => { const element = await render( - +

Test
- , + , ); const parent = element.parentNode; const div = parent.childNodes[0]; diff --git a/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js b/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js index 2080488a2447d..c135cb221a860 100644 --- a/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js +++ b/packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js @@ -391,9 +391,9 @@ describe('ReactDOMServerHydration', () => { it('should be able to render and hydrate Profiler components', () => { const callback = jest.fn(); const markup = ( - +
Hi
-
+ ); const element = document.createElement('div'); diff --git a/packages/react-dom/src/events/__tests__/ChangeEventPlugin-test.internal.js b/packages/react-dom/src/events/__tests__/ChangeEventPlugin-test.internal.js index 03d2cddeaaf84..d01210467b3ef 100644 --- a/packages/react-dom/src/events/__tests__/ChangeEventPlugin-test.internal.js +++ b/packages/react-dom/src/events/__tests__/ChangeEventPlugin-test.internal.js @@ -486,7 +486,7 @@ describe('ChangeEventPlugin', () => { ReactDOM = require('react-dom'); }); it('text input', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); let input; let ops = []; @@ -533,7 +533,7 @@ describe('ChangeEventPlugin', () => { }); it('checkbox input', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); let input; let ops = []; @@ -595,7 +595,7 @@ describe('ChangeEventPlugin', () => { }); it('textarea', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); let textarea; let ops = []; @@ -642,7 +642,7 @@ describe('ChangeEventPlugin', () => { }); it('parent of input', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); let input; let ops = []; @@ -693,7 +693,7 @@ describe('ChangeEventPlugin', () => { }); it('is async for non-input events', () => { - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); let input; let ops = []; diff --git a/packages/react-dom/src/events/__tests__/SimpleEventPlugin-test.internal.js b/packages/react-dom/src/events/__tests__/SimpleEventPlugin-test.internal.js index 3f11c7137145d..09786a103c96f 100644 --- a/packages/react-dom/src/events/__tests__/SimpleEventPlugin-test.internal.js +++ b/packages/react-dom/src/events/__tests__/SimpleEventPlugin-test.internal.js @@ -262,7 +262,7 @@ describe('SimpleEventPlugin', function() { it('flushes pending interactive work before extracting event handler', () => { container = document.createElement('div'); - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); document.body.appendChild(container); let ops = []; @@ -342,7 +342,7 @@ describe('SimpleEventPlugin', function() { it('end result of many interactive updates is deterministic', () => { container = document.createElement('div'); - const root = ReactDOM.unstable_createRoot(container); + const root = ReactDOM.createRoot(container); document.body.appendChild(container); let button; @@ -426,9 +426,9 @@ describe('SimpleEventPlugin', function() { // Intentionally not using the updater form here () => this.setState({highPriCount: this.state.highPriCount + 1}) }> - +
); } diff --git a/packages/react-is/src/__tests__/ReactIs-test.js b/packages/react-is/src/__tests__/ReactIs-test.js index 9838096d3a5d4..d846d9463585c 100644 --- a/packages/react-is/src/__tests__/ReactIs-test.js +++ b/packages/react-is/src/__tests__/ReactIs-test.js @@ -58,9 +58,7 @@ describe('ReactIs', () => { true, ); expect(ReactIs.isValidElementType(React.Fragment)).toEqual(true); - expect(ReactIs.isValidElementType(React.unstable_ConcurrentMode)).toEqual( - true, - ); + expect(ReactIs.isValidElementType(React.ConcurrentMode)).toEqual(true); expect(ReactIs.isValidElementType(React.StrictMode)).toEqual(true); expect(ReactIs.isValidElementType(React.Suspense)).toEqual(true); @@ -73,12 +71,10 @@ describe('ReactIs', () => { }); it('should identify concurrent mode', () => { - expect(ReactIs.typeOf()).toBe( + expect(ReactIs.typeOf()).toBe( ReactIs.ConcurrentMode, ); - expect(ReactIs.isConcurrentMode()).toBe( - true, - ); + expect(ReactIs.isConcurrentMode()).toBe(true); expect(ReactIs.isConcurrentMode({type: ReactIs.ConcurrentMode})).toBe( false, ); @@ -117,7 +113,7 @@ describe('ReactIs', () => { expect(ReactIs.isElement()).toBe(true); expect(ReactIs.isElement()).toBe(true); expect(ReactIs.isElement()).toBe(true); - expect(ReactIs.isElement()).toBe(true); + expect(ReactIs.isElement()).toBe(true); expect(ReactIs.isElement()).toBe(true); expect(ReactIs.isElement()).toBe(true); }); @@ -127,7 +123,7 @@ describe('ReactIs', () => { expect(ReactIs.typeOf()).toBe(ReactIs.ForwardRef); expect(ReactIs.isForwardRef()).toBe(true); expect(ReactIs.isForwardRef({type: ReactIs.StrictMode})).toBe(false); - expect(ReactIs.isForwardRef()).toBe(false); + expect(ReactIs.isForwardRef()).toBe(false); expect(ReactIs.isForwardRef(
)).toBe(false); }); @@ -168,7 +164,7 @@ describe('ReactIs', () => { expect(ReactIs.typeOf()).toBe(ReactIs.StrictMode); expect(ReactIs.isStrictMode()).toBe(true); expect(ReactIs.isStrictMode({type: ReactIs.StrictMode})).toBe(false); - expect(ReactIs.isStrictMode()).toBe(false); + expect(ReactIs.isStrictMode()).toBe(false); expect(ReactIs.isStrictMode(
)).toBe(false); }); @@ -182,15 +178,13 @@ describe('ReactIs', () => { it('should identify profile root', () => { expect( - ReactIs.typeOf(), + ReactIs.typeOf(), ).toBe(ReactIs.Profiler); expect( - ReactIs.isProfiler( - , - ), + ReactIs.isProfiler(), ).toBe(true); - expect(ReactIs.isProfiler({type: ReactIs.unstable_Profiler})).toBe(false); - expect(ReactIs.isProfiler()).toBe(false); + expect(ReactIs.isProfiler({type: ReactIs.Profiler})).toBe(false); + expect(ReactIs.isProfiler()).toBe(false); expect(ReactIs.isProfiler(
)).toBe(false); }); }); diff --git a/packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js b/packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js index 01a462debb6f7..a3714e2c76e96 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js @@ -188,15 +188,15 @@ describe('ReactDebugFiberPerf', () => { it('does not include ConcurrentMode, StrictMode, or Profiler components in measurements', () => { ReactNoop.render( - + - + - + - , + , ); addComment('Mount'); ReactNoop.flush(); diff --git a/packages/react-reconciler/src/__tests__/ReactSuspensePlaceholder-test.internal.js b/packages/react-reconciler/src/__tests__/ReactSuspensePlaceholder-test.internal.js index 6c291de7d16ae..ae671a697728a 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspensePlaceholder-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspensePlaceholder-test.internal.js @@ -50,7 +50,7 @@ function runPlaceholderTests(suiteLabel, loadReactNoop) { ReactTestRenderer.unstable_setNowImplementation(mockNow); ReactCache = require('react-cache'); - Profiler = React.unstable_Profiler; + Profiler = React.Profiler; Suspense = React.Suspense; TextResource = ReactCache.unstable_createResource(([text, ms = 0]) => { diff --git a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js index 9580c425a47b0..0197d120bcec9 100644 --- a/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactSuspenseWithNoopRenderer-test.internal.js @@ -26,7 +26,7 @@ describe('ReactSuspenseWithNoopRenderer', () => { ReactCache = require('react-cache'); Suspense = React.Suspense; StrictMode = React.StrictMode; - ConcurrentMode = React.unstable_ConcurrentMode; + ConcurrentMode = React.ConcurrentMode; TextResource = ReactCache.unstable_createResource(([text, ms = 0]) => { return new Promise((resolve, reject) => diff --git a/packages/react-test-renderer/src/__tests__/ReactShallowRenderer-test.js b/packages/react-test-renderer/src/__tests__/ReactShallowRenderer-test.js index b6c4259af9f40..946130ee96784 100644 --- a/packages/react-test-renderer/src/__tests__/ReactShallowRenderer-test.js +++ b/packages/react-test-renderer/src/__tests__/ReactShallowRenderer-test.js @@ -234,12 +234,12 @@ describe('ReactShallowRenderer', () => { class SomeComponent extends React.Component { render() { return ( - +
-
+ ); } } @@ -247,7 +247,7 @@ describe('ReactShallowRenderer', () => { const shallowRenderer = createRenderer(); const result = shallowRenderer.render(); - expect(result.type).toBe(React.unstable_Profiler); + expect(result.type).toBe(React.Profiler); expect(result.props.children).toEqual(
diff --git a/packages/react-test-renderer/src/__tests__/ReactTestRendererTraversal-test.js b/packages/react-test-renderer/src/__tests__/ReactTestRendererTraversal-test.js index b315d0159eb09..bb20669a9263d 100644 --- a/packages/react-test-renderer/src/__tests__/ReactTestRendererTraversal-test.js +++ b/packages/react-test-renderer/src/__tests__/ReactTestRendererTraversal-test.js @@ -39,9 +39,9 @@ describe('ReactTestRendererTraversal', () => { - {}}> + {}}> - + diff --git a/packages/react/src/__tests__/ReactProfiler-test.internal.js b/packages/react/src/__tests__/ReactProfiler-test.internal.js index f98c7fbfa337f..4b3dfdb2ecf85 100644 --- a/packages/react/src/__tests__/ReactProfiler-test.internal.js +++ b/packages/react/src/__tests__/ReactProfiler-test.internal.js @@ -146,7 +146,7 @@ describe('Profiler', () => { it('should warn if required params are missing', () => { expect(() => { expect(() => { - ReactTestRenderer.create(); + ReactTestRenderer.create(); }).toThrow('onRender is not a function'); }).toWarnDev( 'Profiler must specify an "id" string and "onRender" function as props', @@ -159,7 +159,7 @@ describe('Profiler', () => { // As root expect( ReactTestRenderer.create( - , + , ).toJSON(), ).toMatchSnapshot(); @@ -167,7 +167,7 @@ describe('Profiler', () => { expect( ReactTestRenderer.create(
- +
, ).toJSON(), ).toMatchSnapshot(); @@ -178,10 +178,10 @@ describe('Profiler', () => { const renderer = ReactTestRenderer.create(
outside span - + inside span - +
, ); expect(renderer.toJSON()).toMatchSnapshot(); @@ -195,13 +195,13 @@ describe('Profiler', () => { } } const renderer = ReactTestRenderer.create( - + - + inner span - - , +
+
, ); expect(renderer.toJSON()).toMatchSnapshot(); }); @@ -240,11 +240,11 @@ describe('Profiler', () => { expect(() => ReactTestRenderer.create( - - + +
- - + + , ), ).toThrow('expected'); @@ -261,10 +261,10 @@ describe('Profiler', () => { }; const renderer = ReactTestRenderer.create( - + - , + , { unstable_isConcurrent: true, }, @@ -301,9 +301,9 @@ describe('Profiler', () => { advanceTimeBy(5); // 0 -> 5 const renderer = ReactTestRenderer.create( - + - , + , ); expect(callback).toHaveBeenCalledTimes(1); @@ -324,9 +324,9 @@ describe('Profiler', () => { advanceTimeBy(20); // 15 -> 35 renderer.update( - + - , + , ); expect(callback).toHaveBeenCalledTimes(1); @@ -347,9 +347,9 @@ describe('Profiler', () => { advanceTimeBy(20); // 45 -> 65 renderer.update( - + - , + , ); expect(callback).toHaveBeenCalledTimes(1); @@ -373,13 +373,13 @@ describe('Profiler', () => { ReactTestRenderer.create( - + - + - + - + , ); @@ -408,12 +408,12 @@ describe('Profiler', () => { ReactTestRenderer.create( - + - - + + - + , ); @@ -442,9 +442,9 @@ describe('Profiler', () => { ReactTestRenderer.create( - + - + , ); @@ -478,17 +478,17 @@ describe('Profiler', () => { } const renderer = ReactTestRenderer.create( - + - + - +
- + - + - , + , ); // All profile callbacks are called for initial render @@ -515,11 +515,11 @@ describe('Profiler', () => { advanceTimeBy(5); // 0 -> 5 const renderer = ReactTestRenderer.create( - + - , + , ); expect(callback).toHaveBeenCalledTimes(1); @@ -527,11 +527,11 @@ describe('Profiler', () => { advanceTimeBy(30); // 28 -> 58 renderer.update( - + - , + , ); expect(callback).toHaveBeenCalledTimes(2); @@ -573,17 +573,17 @@ describe('Profiler', () => { advanceTimeBy(5); // 0 -> 5 const renderer = ReactTestRenderer.create( - + - , + , ); advanceTimeBy(15); // 13 -> 28 renderer.update( - + - , + , ); expect(callback).toHaveBeenCalledTimes(2); @@ -617,10 +617,10 @@ describe('Profiler', () => { // Render partially, but run out of time before completing. const renderer = ReactTestRenderer.create( - + - , + , {unstable_isConcurrent: true}, ); expect(renderer).toFlushAndYieldThrough(['Yield:2']); @@ -652,13 +652,13 @@ describe('Profiler', () => { // Render partially, but don't finish. // This partial render should take 5ms of simulated time. const renderer = ReactTestRenderer.create( - + - + - - , + + , {unstable_isConcurrent: true}, ); expect(renderer).toFlushAndYieldThrough(['Yield:5']); @@ -702,10 +702,10 @@ describe('Profiler', () => { // Render a partially update, but don't finish. // This partial render should take 10ms of simulated time. const renderer = ReactTestRenderer.create( - + - , + , {unstable_isConcurrent: true}, ); expect(renderer).toFlushAndYieldThrough(['Yield:10']); @@ -718,9 +718,9 @@ describe('Profiler', () => { // The interrupted work simulates an additional 5ms of time. renderer.unstable_flushSync(() => { renderer.update( - + - , + , ); }); expect(ReactTestRenderer).toHaveYielded(['Yield:5']); @@ -753,10 +753,10 @@ describe('Profiler', () => { advanceTimeBy(5); // 0 -> 5 const renderer = ReactTestRenderer.create( - + - , + , {unstable_isConcurrent: true}, ); @@ -777,11 +777,11 @@ describe('Profiler', () => { // Render a partially update, but don't finish. // This partial render should take 3ms of simulated time. renderer.update( - + - , + , ); expect(renderer).toFlushAndYieldThrough(['Yield:3']); expect(callback).toHaveBeenCalledTimes(0); @@ -800,9 +800,9 @@ describe('Profiler', () => { // The interrupted work simulates an additional 11ms of time. renderer.unstable_flushSync(() => { renderer.update( - + - , + , ); }); expect(ReactTestRenderer).toHaveYielded(['Yield:11']); @@ -859,10 +859,10 @@ describe('Profiler', () => { advanceTimeBy(5); // 0 -> 5 const renderer = ReactTestRenderer.create( - + - , + , {unstable_isConcurrent: true}, ); @@ -975,12 +975,12 @@ describe('Profiler', () => { advanceTimeBy(5); // 0 -> 5 ReactTestRenderer.create( - + - , + , ); expect(callback).toHaveBeenCalledTimes(2); @@ -1054,12 +1054,12 @@ describe('Profiler', () => { advanceTimeBy(5); // 0 -> 5 ReactTestRenderer.create( - + - , + , ); expect(callback).toHaveBeenCalledTimes(1); @@ -1097,29 +1097,29 @@ describe('Profiler', () => { // Simulate a renderer error during the "complete" phase. // This mimics behavior like React Native's View/Text nesting validation. ReactNoop.render( - + hi - , + , ); expect(ReactNoop.flush).toThrow('Error in host config.'); // A similar case we've seen caused by an invariant in ReactDOM. // It didn't reproduce without a host component inside. ReactNoop.render( - + hi - , + , ); expect(ReactNoop.flush).toThrow('Error in host config.'); // So long as the profiler timer's fiber stack is reset correctly, // Subsequent renders should not error. ReactNoop.render( - + hi - , + , ); ReactNoop.flush(); }); @@ -1134,9 +1134,9 @@ describe('Profiler', () => { advanceTimeBy(5); // 0 -> 5 const renderer = ReactTestRenderer.create( - + - , + , ); expect(callback).toHaveBeenCalledTimes(1); @@ -1144,9 +1144,9 @@ describe('Profiler', () => { advanceTimeBy(20); // 7 -> 27 renderer.update( - + - , + , ); expect(callback).toHaveBeenCalledTimes(2); @@ -1189,9 +1189,9 @@ describe('Profiler', () => { } ReactTestRenderer.create( - + - , + , ); expect(callback).toHaveBeenCalledTimes(1); @@ -1519,9 +1519,9 @@ describe('Profiler', () => { mockNow(), () => { renderer = ReactTestRenderer.create( - + - , + , { unstable_isConcurrent: true, }, @@ -1684,9 +1684,9 @@ describe('Profiler', () => { }; SchedulerTracing.unstable_trace(interactionTwo.name, mockNow(), () => { renderer.update( - + - , + , ); }); @@ -1760,10 +1760,10 @@ describe('Profiler', () => { advanceTimeBy(5); const renderer = ReactTestRenderer.create( - + - , + , {unstable_isConcurrent: true}, ); @@ -1935,9 +1935,9 @@ describe('Profiler', () => { let renderer; SchedulerTracing.unstable_trace(interactionOne.name, mockNow(), () => { renderer = ReactTestRenderer.create( - + - , + , {unstable_isConcurrent: true}, ); }); @@ -2133,9 +2133,9 @@ describe('Profiler', () => { render() { parentInstance = this; return ( - + - + ); } } @@ -2218,13 +2218,13 @@ describe('Profiler', () => { const onRender = jest.fn(); SchedulerTracing.unstable_trace(interaction.name, mockNow(), () => { ReactNoop.render( - + }> - , + , ); }); @@ -2306,13 +2306,13 @@ describe('Profiler', () => { interaction.timestamp, () => { ReactTestRenderer.create( - + }> - , + , ); }, ); @@ -2360,13 +2360,13 @@ describe('Profiler', () => { interaction.timestamp, () => { ReactTestRenderer.create( - + }> - , + , ); }, ); @@ -2400,13 +2400,13 @@ describe('Profiler', () => { interaction.timestamp, () => { renderer = ReactTestRenderer.create( - + }> - , + , { unstable_isConcurrent: true, }, @@ -2448,13 +2448,13 @@ describe('Profiler', () => { interaction.timestamp, () => { renderer = ReactTestRenderer.create( - + }> - , + , {unstable_isConcurrent: true}, ); }, @@ -2487,14 +2487,14 @@ describe('Profiler', () => { initialRenderInteraction.timestamp, () => { renderer = ReactTestRenderer.create( - + }> - , + , ); }, ); @@ -2521,14 +2521,14 @@ describe('Profiler', () => { highPriUpdateInteraction.timestamp, () => { renderer.update( - + }> - , + , ); }, ); @@ -2573,14 +2573,14 @@ describe('Profiler', () => { initialRenderInteraction.timestamp, () => { renderer = ReactTestRenderer.create( - + }> - , + , {unstable_isConcurrent: true}, ); }, @@ -2611,14 +2611,14 @@ describe('Profiler', () => { highPriUpdateInteraction.timestamp, () => { renderer.update( - + }> - , + , ); }, ); diff --git a/packages/react/src/__tests__/ReactProfilerDOM-test.internal.js b/packages/react/src/__tests__/ReactProfilerDOM-test.internal.js index 354ccf25b8bb1..1dc5ad1864f62 100644 --- a/packages/react/src/__tests__/ReactProfilerDOM-test.internal.js +++ b/packages/react/src/__tests__/ReactProfilerDOM-test.internal.js @@ -110,7 +110,7 @@ describe('ProfilerDOM', () => { interaction = Array.from(interactions)[0]; element = document.createElement('div'); - const root = ReactDOM.unstable_createRoot(element); + const root = ReactDOM.createRoot(element); batch = root.createBatch(); batch.render( }> diff --git a/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js b/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js index 3e486eefa36aa..37c7664c2bc41 100644 --- a/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js +++ b/packages/react/src/__tests__/ReactProfilerDevToolsIntegration-test.internal.js @@ -68,13 +68,13 @@ describe('ReactProfiler DevTools integration', () => { const App = ({multiplier}) => { advanceTimeBy(2); return ( - + - + ); }; diff --git a/packages/react/src/__tests__/ReactStrictMode-test.internal.js b/packages/react/src/__tests__/ReactStrictMode-test.internal.js index fc279a50a2301..42626289dd999 100644 --- a/packages/react/src/__tests__/ReactStrictMode-test.internal.js +++ b/packages/react/src/__tests__/ReactStrictMode-test.internal.js @@ -313,9 +313,9 @@ describe('ReactStrictMode', () => { UNSAFE_componentWillReceiveProps() {} render() { return ( - + - + ); } } @@ -381,9 +381,9 @@ describe('ReactStrictMode', () => { UNSAFE_componentWillReceiveProps() {} render() { return ( - + - + ); } } @@ -449,22 +449,22 @@ describe('ReactStrictMode', () => { class AsyncRootOne extends React.Component { render() { return ( - + - + ); } } class AsyncRootTwo extends React.Component { render() { return ( - + - + ); } } @@ -517,9 +517,9 @@ describe('ReactStrictMode', () => { class AsyncRoot extends React.Component { render() { return ( - + {this.props.foo ? : } - + ); } }