Skip to content

Commit

Permalink
Convert ReactDOMServerIntegrationLegacyContextDisabled to createRoot (f…
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon authored and AndyPengc12 committed Apr 15, 2024
1 parent c960de2 commit 5e27077
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,29 @@
const ReactDOMServerIntegrationUtils = require('./utils/ReactDOMServerIntegrationTestUtils');

let React;
let ReactDOM;
let ReactDOMClient;
let ReactFeatureFlags;
let ReactDOMServer;

function initModules() {
// Reset warning cache.
jest.resetModules();
React = require('react');
ReactDOM = require('react-dom');
ReactDOMClient = require('react-dom/client');
ReactDOMServer = require('react-dom/server');

ReactFeatureFlags = require('shared/ReactFeatureFlags');
ReactFeatureFlags.disableLegacyContext = true;

// Make them available to the helpers.
return {
ReactDOM,
ReactDOMClient,
ReactDOMServer,
};
}

const {resetModules, itRenders} = ReactDOMServerIntegrationUtils(initModules);
const {resetModules, itRenders, clientRenderOnBadMarkup} =
ReactDOMServerIntegrationUtils(initModules);

function formatValue(val) {
if (val === null) {
Expand Down Expand Up @@ -104,7 +105,7 @@ describe('ReactDOMServerIntegrationLegacyContextDisabled', () => {
<RegularFn />
</span>
</LegacyProvider>,
3,
render === clientRenderOnBadMarkup ? 6 : 3,
);
expect(e.textContent).toBe('{}undefinedundefined');
expect(lifecycleContextLog).toEqual([]);
Expand Down

0 comments on commit 5e27077

Please sign in to comment.