diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationReconnecting-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationReconnecting-test.js index eb201c17b484..76612f510d7d 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationReconnecting-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationReconnecting-test.js @@ -13,30 +13,30 @@ const ReactDOMServerIntegrationUtils = require('./utils/ReactDOMServerIntegratio let React; let ReactDOM; +let ReactDOMClient; let ReactDOMServer; let ReactTestUtils; -function initModules() { - // Reset warning cache. - jest.resetModules(); - - React = require('react'); - ReactDOM = require('react-dom'); - ReactDOMServer = require('react-dom/server'); - ReactTestUtils = require('react-dom/test-utils'); - - // Make them available to the helpers. - return { - ReactDOM, - ReactDOMServer, - ReactTestUtils, - }; -} - -const {resetModules, expectMarkupMismatch, expectMarkupMatch} = - ReactDOMServerIntegrationUtils(initModules); - describe('ReactDOMServerIntegration', () => { + function initModules() { + // Reset warning cache. + jest.resetModules(); + + React = require('react'); + ReactDOMClient = require('react-dom/client'); + ReactDOMServer = require('react-dom/server'); + ReactTestUtils = require('react-dom/test-utils'); + + // Make them available to the helpers. + return { + ReactDOMClient, + ReactDOMServer, + ReactTestUtils, + }; + } + + const {resetModules, expectMarkupMismatch, expectMarkupMatch} = + ReactDOMServerIntegrationUtils(initModules); beforeEach(() => { resetModules(); }); @@ -123,8 +123,8 @@ describe('ReactDOMServerIntegration', () => { it('should error reconnecting different attribute values', () => expectMarkupMismatch(
,
)); - it('can explicitly ignore errors reconnecting different element types of children', () => - expectMarkupMatch( + it('should error reconnecting different element types of children', () => + expectMarkupMismatch(
, @@ -354,8 +354,8 @@ describe('ReactDOMServerIntegration', () => {
{''}
, )); - it('can explicitly ignore reconnecting more children', () => - expectMarkupMatch( + it('can not ignore reconnecting more children', () => + expectMarkupMismatch(
, @@ -365,8 +365,8 @@ describe('ReactDOMServerIntegration', () => {
, )); - it('can explicitly ignore reconnecting fewer children', () => - expectMarkupMatch( + it('can not ignore reconnecting fewer children', () => + expectMarkupMismatch(
@@ -376,8 +376,8 @@ describe('ReactDOMServerIntegration', () => {
, )); - it('can explicitly ignore reconnecting reordered children', () => - expectMarkupMatch( + it('can not ignore reconnecting reordered children', () => + expectMarkupMismatch(
@@ -456,3 +456,73 @@ describe('ReactDOMServerIntegration', () => { )); }); }); + +describe('ReactDOMServerIntegration (legacy)', () => { + function initModules() { + // Reset warning cache. + jest.resetModules(); + + React = require('react'); + ReactDOM = require('react-dom'); + ReactDOMServer = require('react-dom/server'); + ReactTestUtils = require('react-dom/test-utils'); + + // Make them available to the helpers. + return { + ReactDOM, + ReactDOMServer, + ReactTestUtils, + }; + } + + const {resetModules, expectMarkupMatch} = + ReactDOMServerIntegrationUtils(initModules); + + beforeEach(() => { + resetModules(); + }); + + it('legacy mode can explicitly ignore errors reconnecting different element types of children', () => + expectMarkupMatch( +
+
+
, +
+ +
, + )); + + it('legacy mode can explicitly ignore reconnecting more children', () => + expectMarkupMatch( +
+
+
, +
+
+
+
, + )); + + it('legacy mode can explicitly ignore reconnecting fewer children', () => + expectMarkupMatch( +
+
+
+
, +
+
+
, + )); + + it('legacy mode can explicitly ignore reconnecting reordered children', () => + expectMarkupMatch( +
+
+ +
, +
+ +
+
, + )); +});