Skip to content

Commit 36e6c1d

Browse files
committed
add tests confirming you can hydrate without a head
1 parent edfb246 commit 36e6c1d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

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

+33
Original file line numberDiff line numberDiff line change
@@ -975,4 +975,37 @@ describe('ReactDOM HostSingleton', () => {
975975
</html>,
976976
);
977977
});
978+
979+
// @gate enableHostSingletons
980+
it('allows for hydrating without a head', async () => {
981+
await actIntoEmptyDocument(() => {
982+
const {pipe} = ReactDOMFizzServer.renderToPipeableStream(
983+
<html>
984+
<body>foo</body>
985+
</html>,
986+
);
987+
pipe(writable);
988+
});
989+
990+
expect(getVisibleChildren(document)).toEqual(
991+
<html>
992+
<head />
993+
<body>foo</body>
994+
</html>,
995+
);
996+
997+
ReactDOMClient.hydrateRoot(
998+
document,
999+
<html>
1000+
<body>foo</body>
1001+
</html>,
1002+
);
1003+
expect(Scheduler).toFlushWithoutYielding();
1004+
expect(getVisibleChildren(document)).toEqual(
1005+
<html>
1006+
<head />
1007+
<body>foo</body>
1008+
</html>,
1009+
);
1010+
});
9781011
});

0 commit comments

Comments
 (0)