@@ -240,23 +240,18 @@ describe('ReactDOMFizzServerHydrationWarning', () => { |
240 | 240 | Scheduler.unstable_yieldValue(error.message); |
241 | 241 | }, |
242 | 242 | }); |
243 | | - if (gate(flags => flags.enableClientRenderFallbackOnHydrationMismatch)) { |
244 | | - expect(() => { |
245 | | - expect(Scheduler).toFlushAndYield([ |
246 | | - 'Hydration failed because the initial UI does not match what was rendered on the server.', |
247 | | - 'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.', |
248 | | - ]); |
249 | | - }).toErrorDev( |
250 | | - [ |
251 | | - 'Expected server HTML to contain a matching <span> in <span>', |
252 | | - 'An error occurred during hydration. The server HTML was replaced with client content in <div>.', |
253 | | - ], |
254 | | - {withoutStack: 1}, |
255 | | - ); |
256 | | - } else { |
257 | | - // This used to not warn. |
258 | | - expect(Scheduler).toFlushAndYield([]); |
259 | | - } |
| 243 | + expect(() => { |
| 244 | + expect(Scheduler).toFlushAndYield([ |
| 245 | + 'Hydration failed because the initial UI does not match what was rendered on the server.', |
| 246 | + 'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.', |
| 247 | + ]); |
| 248 | + }).toErrorDev( |
| 249 | + [ |
| 250 | + 'Expected server HTML to contain a matching <span> in <span>', |
| 251 | + 'An error occurred during hydration. The server HTML was replaced with client content in <div>.', |
| 252 | + ], |
| 253 | + {withoutStack: 1}, |
| 254 | + ); |
260 | 255 | expect(getVisibleChildren(container)).toEqual( |
261 | 256 | <div> |
262 | 257 | <span> |
@@ -329,23 +324,18 @@ describe('ReactDOMFizzServerHydrationWarning', () => { |
329 | 324 | Scheduler.unstable_yieldValue(error.message); |
330 | 325 | }, |
331 | 326 | }); |
332 | | - if (gate(flags => flags.enableClientRenderFallbackOnHydrationMismatch)) { |
333 | | - expect(() => { |
334 | | - expect(Scheduler).toFlushAndYield([ |
335 | | - 'Hydration failed because the initial UI does not match what was rendered on the server.', |
336 | | - 'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.', |
337 | | - ]); |
338 | | - }).toErrorDev( |
339 | | - [ |
340 | | - 'Did not expect server HTML to contain the text node "Server" in <span>', |
341 | | - 'An error occurred during hydration. The server HTML was replaced with client content in <div>.', |
342 | | - ], |
343 | | - {withoutStack: 1}, |
344 | | - ); |
345 | | - } else { |
346 | | - // This used to not warn. |
347 | | - expect(Scheduler).toFlushAndYield([]); |
348 | | - } |
| 327 | + expect(() => { |
| 328 | + expect(Scheduler).toFlushAndYield([ |
| 329 | + 'Hydration failed because the initial UI does not match what was rendered on the server.', |
| 330 | + 'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.', |
| 331 | + ]); |
| 332 | + }).toErrorDev( |
| 333 | + [ |
| 334 | + 'Did not expect server HTML to contain the text node "Server" in <span>', |
| 335 | + 'An error occurred during hydration. The server HTML was replaced with client content in <div>.', |
| 336 | + ], |
| 337 | + {withoutStack: 1}, |
| 338 | + ); |
349 | 339 | expect(getVisibleChildren(container)).toEqual( |
350 | 340 | <div> |
351 | 341 | <span /> |
@@ -383,23 +373,18 @@ describe('ReactDOMFizzServerHydrationWarning', () => { |
383 | 373 | Scheduler.unstable_yieldValue(error.message); |
384 | 374 | }, |
385 | 375 | }); |
386 | | - if (gate(flags => flags.enableClientRenderFallbackOnHydrationMismatch)) { |
387 | | - expect(() => { |
388 | | - expect(Scheduler).toFlushAndYield([ |
389 | | - 'Hydration failed because the initial UI does not match what was rendered on the server.', |
390 | | - 'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.', |
391 | | - ]); |
392 | | - }).toErrorDev( |
393 | | - [ |
394 | | - 'Expected server HTML to contain a matching text node for "Client" in <span>.', |
395 | | - 'An error occurred during hydration. The server HTML was replaced with client content in <div>.', |
396 | | - ], |
397 | | - {withoutStack: 1}, |
398 | | - ); |
399 | | - } else { |
400 | | - // This used to not warn. |
401 | | - expect(Scheduler).toFlushAndYield([]); |
402 | | - } |
| 376 | + expect(() => { |
| 377 | + expect(Scheduler).toFlushAndYield([ |
| 378 | + 'Hydration failed because the initial UI does not match what was rendered on the server.', |
| 379 | + 'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.', |
| 380 | + ]); |
| 381 | + }).toErrorDev( |
| 382 | + [ |
| 383 | + 'Expected server HTML to contain a matching text node for "Client" in <span>.', |
| 384 | + 'An error occurred during hydration. The server HTML was replaced with client content in <div>.', |
| 385 | + ], |
| 386 | + {withoutStack: 1}, |
| 387 | + ); |
403 | 388 | expect(getVisibleChildren(container)).toEqual( |
404 | 389 | <div> |
405 | 390 | <span> |
@@ -440,23 +425,18 @@ describe('ReactDOMFizzServerHydrationWarning', () => { |
440 | 425 | Scheduler.unstable_yieldValue(error.message); |
441 | 426 | }, |
442 | 427 | }); |
443 | | - if (gate(flags => flags.enableClientRenderFallbackOnHydrationMismatch)) { |
444 | | - expect(() => { |
445 | | - expect(Scheduler).toFlushAndYield([ |
446 | | - 'Hydration failed because the initial UI does not match what was rendered on the server.', |
447 | | - 'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.', |
448 | | - ]); |
449 | | - }).toErrorDev( |
450 | | - [ |
451 | | - 'Did not expect server HTML to contain the text node "Server" in <span>.', |
452 | | - 'An error occurred during hydration. The server HTML was replaced with client content in <div>.', |
453 | | - ], |
454 | | - {withoutStack: 1}, |
455 | | - ); |
456 | | - } else { |
457 | | - // This used to not warn. |
458 | | - expect(Scheduler).toFlushAndYield([]); |
459 | | - } |
| 428 | + expect(() => { |
| 429 | + expect(Scheduler).toFlushAndYield([ |
| 430 | + 'Hydration failed because the initial UI does not match what was rendered on the server.', |
| 431 | + 'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.', |
| 432 | + ]); |
| 433 | + }).toErrorDev( |
| 434 | + [ |
| 435 | + 'Did not expect server HTML to contain the text node "Server" in <span>.', |
| 436 | + 'An error occurred during hydration. The server HTML was replaced with client content in <div>.', |
| 437 | + ], |
| 438 | + {withoutStack: 1}, |
| 439 | + ); |
460 | 440 | expect(getVisibleChildren(container)).toEqual( |
461 | 441 | <div> |
462 | 442 | <span> |
@@ -495,24 +475,19 @@ describe('ReactDOMFizzServerHydrationWarning', () => { |
495 | 475 | Scheduler.unstable_yieldValue(error.message); |
496 | 476 | }, |
497 | 477 | }); |
498 | | - if (gate(flags => flags.enableClientRenderFallbackOnHydrationMismatch)) { |
499 | | - expect(() => { |
500 | | - expect(Scheduler).toFlushAndYield([ |
501 | | - 'Hydration failed because the initial UI does not match what was rendered on the server.', |
502 | | - 'Hydration failed because the initial UI does not match what was rendered on the server.', |
503 | | - 'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.', |
504 | | - ]); |
505 | | - }).toErrorDev( |
506 | | - [ |
507 | | - 'Expected server HTML to contain a matching text node for "Client" in <span>.', |
508 | | - 'An error occurred during hydration. The server HTML was replaced with client content in <div>.', |
509 | | - ], |
510 | | - {withoutStack: 1}, |
511 | | - ); |
512 | | - } else { |
513 | | - // This used to not warn. |
514 | | - expect(Scheduler).toFlushAndYield([]); |
515 | | - } |
| 478 | + expect(() => { |
| 479 | + expect(Scheduler).toFlushAndYield([ |
| 480 | + 'Hydration failed because the initial UI does not match what was rendered on the server.', |
| 481 | + 'Hydration failed because the initial UI does not match what was rendered on the server.', |
| 482 | + 'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.', |
| 483 | + ]); |
| 484 | + }).toErrorDev( |
| 485 | + [ |
| 486 | + 'Expected server HTML to contain a matching text node for "Client" in <span>.', |
| 487 | + 'An error occurred during hydration. The server HTML was replaced with client content in <div>.', |
| 488 | + ], |
| 489 | + {withoutStack: 1}, |
| 490 | + ); |
516 | 491 | expect(getVisibleChildren(container)).toEqual( |
517 | 492 | <div> |
518 | 493 | <span> |
@@ -627,23 +602,18 @@ describe('ReactDOMFizzServerHydrationWarning', () => { |
627 | 602 | Scheduler.unstable_yieldValue(error.message); |
628 | 603 | }, |
629 | 604 | }); |
630 | | - if (gate(flags => flags.enableClientRenderFallbackOnHydrationMismatch)) { |
631 | | - expect(() => { |
632 | | - expect(Scheduler).toFlushAndYield([ |
633 | | - 'Hydration failed because the initial UI does not match what was rendered on the server.', |
634 | | - 'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.', |
635 | | - ]); |
636 | | - }).toErrorDev( |
637 | | - [ |
638 | | - 'Expected server HTML to contain a matching <p> in <div>.', |
639 | | - 'An error occurred during hydration. The server HTML was replaced with client content in <div>.', |
640 | | - ], |
641 | | - {withoutStack: 1}, |
642 | | - ); |
643 | | - } else { |
644 | | - // This used to not warn. |
645 | | - expect(Scheduler).toFlushAndYield([]); |
646 | | - } |
| 605 | + expect(() => { |
| 606 | + expect(Scheduler).toFlushAndYield([ |
| 607 | + 'Hydration failed because the initial UI does not match what was rendered on the server.', |
| 608 | + 'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.', |
| 609 | + ]); |
| 610 | + }).toErrorDev( |
| 611 | + [ |
| 612 | + 'Expected server HTML to contain a matching <p> in <div>.', |
| 613 | + 'An error occurred during hydration. The server HTML was replaced with client content in <div>.', |
| 614 | + ], |
| 615 | + {withoutStack: 1}, |
| 616 | + ); |
647 | 617 | expect(getVisibleChildren(container)).toEqual( |
648 | 618 | <div> |
649 | 619 | <p>Client and server</p> |
@@ -679,23 +649,18 @@ describe('ReactDOMFizzServerHydrationWarning', () => { |
679 | 649 | Scheduler.unstable_yieldValue(error.message); |
680 | 650 | }, |
681 | 651 | }); |
682 | | - if (gate(flags => flags.enableClientRenderFallbackOnHydrationMismatch)) { |
683 | | - expect(() => { |
684 | | - expect(Scheduler).toFlushAndYield([ |
685 | | - 'Hydration failed because the initial UI does not match what was rendered on the server.', |
686 | | - 'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.', |
687 | | - ]); |
688 | | - }).toErrorDev( |
689 | | - [ |
690 | | - 'Did not expect server HTML to contain a <p> in <div>.', |
691 | | - 'An error occurred during hydration. The server HTML was replaced with client content in <div>.', |
692 | | - ], |
693 | | - {withoutStack: 1}, |
694 | | - ); |
695 | | - } else { |
696 | | - // This used to not warn. |
697 | | - expect(Scheduler).toFlushAndYield([]); |
698 | | - } |
| 652 | + expect(() => { |
| 653 | + expect(Scheduler).toFlushAndYield([ |
| 654 | + 'Hydration failed because the initial UI does not match what was rendered on the server.', |
| 655 | + 'There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.', |
| 656 | + ]); |
| 657 | + }).toErrorDev( |
| 658 | + [ |
| 659 | + 'Did not expect server HTML to contain a <p> in <div>.', |
| 660 | + 'An error occurred during hydration. The server HTML was replaced with client content in <div>.', |
| 661 | + ], |
| 662 | + {withoutStack: 1}, |
| 663 | + ); |
699 | 664 | expect(getVisibleChildren(container)).toEqual( |
700 | 665 | <div> |
701 | 666 | <p>Client and server</p> |
|