Skip to content

Commit

Permalink
add tests confirming you can hydrate without a head
Browse files Browse the repository at this point in the history
  • Loading branch information
gnoff committed Oct 21, 2022
1 parent edfb246 commit 36e6c1d
Showing 1 changed file with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -975,4 +975,37 @@ describe('ReactDOM HostSingleton', () => {
</html>,
);
});

// @gate enableHostSingletons
it('allows for hydrating without a head', async () => {
await actIntoEmptyDocument(() => {
const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
<html>
<body>foo</body>
</html>,
);
pipe(writable);
});

expect(getVisibleChildren(document)).toEqual(
<html>
<head />
<body>foo</body>
</html>,
);

ReactDOMClient.hydrateRoot(
document,
<html>
<body>foo</body>
</html>,
);
expect(Scheduler).toFlushWithoutYielding();
expect(getVisibleChildren(document)).toEqual(
<html>
<head />
<body>foo</body>
</html>,
);
});
});

0 comments on commit 36e6c1d

Please sign in to comment.