You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update Float tests to check for specific errors (#26367)
I updated some of the Float tests that intentionally trigger an error to
assert on the specific error message, rather than swallow any errors
that may or may not happen.
'The node to be removed is not a child of this node',
382
+
);
383
+
}).toErrorDev(
394
384
[
395
385
'Cannot render <noscript> outside the main document. Try moving it into the root <head> tag.',
396
386
'Warning: validateDOMNesting(...): <noscript> cannot appear as a child of <#document>.',
397
387
],
398
388
{withoutStack: 1},
399
389
);
400
390
401
-
renderSafelyAndExpect(
402
-
root,
403
-
<html>
404
-
<template>foo</template>
405
-
<body>foo</body>
406
-
</html>,
407
-
).toErrorDev([
391
+
awaitexpect(async()=>{
392
+
root.render(
393
+
<html>
394
+
<template>foo</template>
395
+
<body>foo</body>
396
+
</html>,
397
+
);
398
+
awaitwaitForAll([]);
399
+
}).toErrorDev([
408
400
'Cannot render <template> outside the main document. Try moving it into the root <head> tag.',
409
401
'Warning: validateDOMNesting(...): <template> cannot appear as a child of <html>.',
410
402
]);
411
403
412
-
renderSafelyAndExpect(
413
-
root,
414
-
<html>
415
-
<body>foo</body>
416
-
<style>foo</style>
417
-
</html>,
418
-
).toErrorDev([
404
+
awaitexpect(async()=>{
405
+
root.render(
406
+
<html>
407
+
<body>foo</body>
408
+
<style>foo</style>
409
+
</html>,
410
+
);
411
+
awaitwaitForAll([]);
412
+
}).toErrorDev([
419
413
'Cannot render a <style> outside the main document without knowing its precedence and a unique href key. React can hoist and deduplicate <style> tags if you provide a `precedence` prop along with an `href` prop that does not conflic with the `href` values used in any other hoisted <style> or <link rel="stylesheet" ...> tags. Note that hoisting <style> tags is considered an advanced feature that most will not use directly. Consider moving the <style> tag to the <head> or consider adding a `precedence="default"` and `href="some unique resource identifier"`, or move the <style> to the <style> tag.',
420
414
'Warning: validateDOMNesting(...): <style> cannot appear as a child of <html>.',
'The node to be removed is not a child of this node',
433
+
);
434
+
}).toErrorDev(
432
435
[
433
436
'Cannot render a <link rel="stylesheet" /> outside the main document without knowing its precedence. Consider adding precedence="default" or moving it into the root <head> tag.',
434
437
'Warning: validateDOMNesting(...): <link> cannot appear as a child of <#document>.',
435
438
],
436
439
{withoutStack: 1},
437
440
);
438
441
439
-
renderSafelyAndExpect(
440
-
root,
441
-
<>
442
-
<html>
443
-
<body>foo</body>
444
-
<scripthref="foo"/>
445
-
</html>
446
-
</>,
447
-
).toErrorDev([
442
+
awaitexpect(async()=>{
443
+
root.render(
444
+
<>
445
+
<html>
446
+
<body>foo</body>
447
+
<scripthref="foo"/>
448
+
</html>
449
+
</>,
450
+
);
451
+
awaitwaitForAll([]);
452
+
}).toErrorDev([
448
453
'Cannot render a sync or defer <script> outside the main document without knowing its order. Try adding async="" or moving it into the root <head> tag.',
449
454
'Warning: validateDOMNesting(...): <script> cannot appear as a child of <html>.',
450
455
]);
451
456
452
-
renderSafelyAndExpect(
453
-
root,
454
-
<>
457
+
awaitexpect(async()=>{
458
+
root.render(
455
459
<html>
456
460
<scriptasync={true}onLoad={()=>{}}href="bar"/>
457
461
<body>foo</body>
458
-
</html>
459
-
</>,
460
-
).toErrorDev([
462
+
</html>,
463
+
);
464
+
awaitwaitForAll([]);
465
+
}).toErrorDev([
461
466
'Cannot render a <script> with onLoad or onError listeners outside the main document. Try removing onLoad={...} and onError={...} or moving it into the root <head> tag or somewhere in the <body>.',
'The node to be removed is not a child of this node',
485
+
);
486
+
}).toErrorDev(
473
487
[
474
488
'Cannot render a <link> with onLoad or onError listeners outside the main document. Try removing onLoad={...} and onError={...} or moving it into the root <head> tag or somewhere in the <body>.',
475
489
],
@@ -5638,22 +5652,16 @@ background-color: green;
5638
5652
},
5639
5653
},
5640
5654
);
5641
-
try{
5642
-
awaitexpect(async()=>{
5643
-
awaitwaitForAll([]);
5644
-
}).toErrorDev(
5645
-
[
5646
-
'Warning: Text content did not match. Server: "server" Client: "client"',
5647
-
'Warning: An error occurred during hydration. The server HTML was replaced with client content in <#document>.',
5648
-
],
5649
-
{withoutStack: 1},
5650
-
);
5651
-
}catch(e){
5652
-
// When gates are false this test fails on a DOMException if you don't clear the scheduler after catching.
5653
-
// When gates are true this branch should not be hit
5655
+
5656
+
awaitexpect(async()=>{
5654
5657
awaitwaitForAll([]);
5655
-
throwe;
5656
-
}
5658
+
}).toErrorDev(
5659
+
[
5660
+
'Warning: Text content did not match. Server: "server" Client: "client"',
5661
+
'Warning: An error occurred during hydration. The server HTML was replaced with client content in <#document>.',
0 commit comments