Skip to content

Commit d172865

Browse files
committed
Add test to verify crossOrigin does not factor into keying
1 parent a6231aa commit d172865

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3971,6 +3971,34 @@ body {
39713971
);
39723972
});
39733973

3974+
it('does not include crossOrigin when keying image preloads', async () => {
3975+
function App() {
3976+
return (
3977+
<html>
3978+
<body>
3979+
<img src="foo.png" crossOrigin="" />
3980+
<img src="foo.png" crossOrigin="anonymous" />
3981+
</body>
3982+
</html>
3983+
);
3984+
}
3985+
3986+
await act(() => {
3987+
renderToPipeableStream(<App />).pipe(writable);
3988+
});
3989+
expect(getMeaningfulChildren(document)).toEqual(
3990+
<html>
3991+
<head>
3992+
<link rel="preload" as="image" crossorigin="" href="foo.png"></link>
3993+
</head>
3994+
<body>
3995+
<img src="foo.png" crossorigin="" />
3996+
<img src="foo.png" crossorigin="anonymous" />
3997+
</body>
3998+
</html>,
3999+
);
4000+
});
4001+
39744002
it('can emit preloads for non-lazy images that are rendered', async () => {
39754003
function App() {
39764004
ReactDOM.preload('script', {as: 'script'});

0 commit comments

Comments
 (0)