Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix tests for www
  • Loading branch information
Sebastian Silbermann committed Feb 7, 2024
commit da2c623e2b9d33c41b0c330b5f95cde28ea84d22
29 changes: 20 additions & 9 deletions packages/react-dom/src/__tests__/ReactRenderDocument-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ describe('rendering React components at document', () => {
);
const testDocument = getTestDocument(markup);

const enableClientRenderFallbackOnTextMismatch = gate(
flags => flags.enableClientRenderFallbackOnTextMismatch,
);
expect(() => {
ReactDOM.flushSync(() => {
ReactDOMClient.hydrateRoot(
Expand All @@ -278,17 +281,25 @@ describe('rendering React components at document', () => {
);
});
}).toErrorDev(
[
'Warning: An error occurred during hydration. The server HTML was replaced with client content in <#document>.',
'Warning: Text content did not match.',
],
{withoutStack: 1},
enableClientRenderFallbackOnTextMismatch
? [
'Warning: An error occurred during hydration. The server HTML was replaced with client content in <#document>.',
'Warning: Text content did not match.',
]
: ['Warning: Text content did not match.'],
{
withoutStack: enableClientRenderFallbackOnTextMismatch ? 1 : 0,
},
);

assertLog([
'Log recoverable error: Text content does not match server-rendered HTML.',
'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.',
]);
assertLog(
enableClientRenderFallbackOnTextMismatch
? [
'Log recoverable error: Text content does not match server-rendered HTML.',
'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.',
]
: [],
);
expect(testDocument.body.innerHTML).toBe('Hello world');
});

Expand Down