Skip to content

Commit

Permalink
Convert ReactDOMServerIntegrationLegacyContext to createRoot
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Silbermann committed Feb 26, 2024
1 parent 2f240c9 commit d1b7907
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,30 @@ const ReactDOMServerIntegrationUtils = require('./utils/ReactDOMServerIntegratio

let PropTypes;
let React;
let ReactDOM;
let ReactDOMClient;
let ReactDOMServer;

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

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

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

describe('ReactDOMServerIntegration', () => {
beforeEach(() => {
Expand Down Expand Up @@ -272,7 +276,10 @@ describe('ReactDOMServerIntegration', () => {
return {foo: 'bar'};
}
}
const e = await render(<ForgetfulParent />, 1);
const e = await render(
<ForgetfulParent />,
render === clientRenderOnBadMarkup ? 4 : 1,
);
expect(e.textContent).toBe('nope');
},
);
Expand Down

0 comments on commit d1b7907

Please sign in to comment.