@@ -2415,8 +2415,18 @@ describe('ReactDOMServerPartialHydration', () => {
2415
2415
await promise ;
2416
2416
} ) ;
2417
2417
2418
- expect ( clicks ) . toBe ( 0 ) ;
2419
- expect ( container . textContent ) . toBe ( 'Click meHello' ) ;
2418
+ if (
2419
+ gate (
2420
+ flags =>
2421
+ flags . enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ,
2422
+ )
2423
+ ) {
2424
+ expect ( clicks ) . toBe ( 0 ) ;
2425
+ expect ( container . textContent ) . toBe ( 'Click meHello' ) ;
2426
+ } else {
2427
+ expect ( clicks ) . toBe ( 1 ) ;
2428
+ expect ( container . textContent ) . toBe ( 'Hello' ) ;
2429
+ }
2420
2430
document . body . removeChild ( container ) ;
2421
2431
} ) ;
2422
2432
@@ -2498,7 +2508,17 @@ describe('ReactDOMServerPartialHydration', () => {
2498
2508
await promise ;
2499
2509
} ) ;
2500
2510
2501
- expect ( onEvent ) . toHaveBeenCalledTimes ( 0 ) ;
2511
+ if (
2512
+ gate (
2513
+ flags =>
2514
+ flags . enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ,
2515
+ )
2516
+ ) {
2517
+ expect ( onEvent ) . toHaveBeenCalledTimes ( 0 ) ;
2518
+ } else {
2519
+ expect ( onEvent ) . toHaveBeenCalledTimes ( 2 ) ;
2520
+ }
2521
+
2502
2522
document . body . removeChild ( container ) ;
2503
2523
} ) ;
2504
2524
@@ -2578,7 +2598,16 @@ describe('ReactDOMServerPartialHydration', () => {
2578
2598
await promise ;
2579
2599
} ) ;
2580
2600
2581
- expect ( clicks ) . toBe ( 0 ) ;
2601
+ if (
2602
+ gate (
2603
+ flags =>
2604
+ flags . enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ,
2605
+ )
2606
+ ) {
2607
+ expect ( clicks ) . toBe ( 0 ) ;
2608
+ } else {
2609
+ expect ( clicks ) . toBe ( 2 ) ;
2610
+ }
2582
2611
2583
2612
document . body . removeChild ( container ) ;
2584
2613
} ) ;
@@ -2663,7 +2692,17 @@ describe('ReactDOMServerPartialHydration', () => {
2663
2692
resolve ( ) ;
2664
2693
await promise ;
2665
2694
} ) ;
2666
- expect ( onEvent ) . toHaveBeenCalledTimes ( 0 ) ;
2695
+ if (
2696
+ gate (
2697
+ flags =>
2698
+ flags . enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ,
2699
+ )
2700
+ ) {
2701
+ expect ( onEvent ) . toHaveBeenCalledTimes ( 0 ) ;
2702
+ } else {
2703
+ expect ( onEvent ) . toHaveBeenCalledTimes ( 2 ) ;
2704
+ }
2705
+
2667
2706
document . body . removeChild ( container ) ;
2668
2707
} ) ;
2669
2708
@@ -2734,8 +2773,19 @@ describe('ReactDOMServerPartialHydration', () => {
2734
2773
await promise ;
2735
2774
} ) ;
2736
2775
2737
- expect ( clicksOnChild ) . toBe ( 0 ) ;
2738
- expect ( clicksOnParent ) . toBe ( 0 ) ;
2776
+ if (
2777
+ gate (
2778
+ flags =>
2779
+ flags . enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ,
2780
+ )
2781
+ ) {
2782
+ expect ( clicksOnChild ) . toBe ( 0 ) ;
2783
+ expect ( clicksOnParent ) . toBe ( 0 ) ;
2784
+ } else {
2785
+ expect ( clicksOnChild ) . toBe ( 1 ) ;
2786
+ // This will be zero due to the stopPropagation.
2787
+ expect ( clicksOnParent ) . toBe ( 0 ) ;
2788
+ }
2739
2789
2740
2790
document . body . removeChild ( container ) ;
2741
2791
} ) ;
@@ -2811,7 +2861,16 @@ describe('ReactDOMServerPartialHydration', () => {
2811
2861
} ) ;
2812
2862
2813
2863
// We're now full hydrated.
2814
- expect ( clicks ) . toBe ( 0 ) ;
2864
+ if (
2865
+ gate (
2866
+ flags =>
2867
+ flags . enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ,
2868
+ )
2869
+ ) {
2870
+ expect ( clicks ) . toBe ( 0 ) ;
2871
+ } else {
2872
+ expect ( clicks ) . toBe ( 1 ) ;
2873
+ }
2815
2874
2816
2875
document . body . removeChild ( parentContainer ) ;
2817
2876
} ) ;
@@ -3080,9 +3139,19 @@ describe('ReactDOMServerPartialHydration', () => {
3080
3139
await promise ;
3081
3140
} ) ;
3082
3141
3083
- // discrete event not replayed
3084
- expect ( submits ) . toBe ( 0 ) ;
3085
- expect ( container . textContent ) . toBe ( 'Click meHello' ) ;
3142
+ if (
3143
+ gate (
3144
+ flags =>
3145
+ flags . enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ,
3146
+ )
3147
+ ) {
3148
+ // discrete event not replayed
3149
+ expect ( submits ) . toBe ( 0 ) ;
3150
+ expect ( container . textContent ) . toBe ( 'Click meHello' ) ;
3151
+ } else {
3152
+ expect ( submits ) . toBe ( 1 ) ;
3153
+ expect ( container . textContent ) . toBe ( 'Hello' ) ;
3154
+ }
3086
3155
3087
3156
document . body . removeChild ( container ) ;
3088
3157
} ) ;
0 commit comments