Skip to content

Commit da2c623

Browse files
author
Sebastian Silbermann
committed
Fix tests for www
1 parent b5b31e7 commit da2c623

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

packages/react-dom/src/__tests__/ReactRenderDocument-test.js

+20-9
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ describe('rendering React components at document', () => {
265265
);
266266
const testDocument = getTestDocument(markup);
267267

268+
const enableClientRenderFallbackOnTextMismatch = gate(
269+
flags => flags.enableClientRenderFallbackOnTextMismatch,
270+
);
268271
expect(() => {
269272
ReactDOM.flushSync(() => {
270273
ReactDOMClient.hydrateRoot(
@@ -278,17 +281,25 @@ describe('rendering React components at document', () => {
278281
);
279282
});
280283
}).toErrorDev(
281-
[
282-
'Warning: An error occurred during hydration. The server HTML was replaced with client content in <#document>.',
283-
'Warning: Text content did not match.',
284-
],
285-
{withoutStack: 1},
284+
enableClientRenderFallbackOnTextMismatch
285+
? [
286+
'Warning: An error occurred during hydration. The server HTML was replaced with client content in <#document>.',
287+
'Warning: Text content did not match.',
288+
]
289+
: ['Warning: Text content did not match.'],
290+
{
291+
withoutStack: enableClientRenderFallbackOnTextMismatch ? 1 : 0,
292+
},
286293
);
287294

288-
assertLog([
289-
'Log recoverable error: Text content does not match server-rendered HTML.',
290-
'Log recoverable error: There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.',
291-
]);
295+
assertLog(
296+
enableClientRenderFallbackOnTextMismatch
297+
? [
298+
'Log recoverable error: Text content does not match server-rendered HTML.',
299+
'Log recoverable error: There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.',
300+
]
301+
: [],
302+
);
292303
expect(testDocument.body.innerHTML).toBe('Hello world');
293304
});
294305

0 commit comments

Comments
 (0)