@@ -2418,8 +2418,18 @@ describe('ReactDOMServerPartialHydration', () => {
2418
2418
await promise ;
2419
2419
} ) ;
2420
2420
2421
- expect ( clicks ) . toBe ( 0 ) ;
2422
- expect ( container . textContent ) . toBe ( 'Click meHello' ) ;
2421
+ if (
2422
+ gate (
2423
+ flags =>
2424
+ flags . enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ,
2425
+ )
2426
+ ) {
2427
+ expect ( clicks ) . toBe ( 0 ) ;
2428
+ expect ( container . textContent ) . toBe ( 'Click meHello' ) ;
2429
+ } else {
2430
+ expect ( clicks ) . toBe ( 1 ) ;
2431
+ expect ( container . textContent ) . toBe ( 'Hello' ) ;
2432
+ }
2423
2433
document . body . removeChild ( container ) ;
2424
2434
} ) ;
2425
2435
@@ -2501,7 +2511,17 @@ describe('ReactDOMServerPartialHydration', () => {
2501
2511
await promise ;
2502
2512
} ) ;
2503
2513
2504
- expect ( onEvent ) . toHaveBeenCalledTimes ( 0 ) ;
2514
+ if (
2515
+ gate (
2516
+ flags =>
2517
+ flags . enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ,
2518
+ )
2519
+ ) {
2520
+ expect ( onEvent ) . toHaveBeenCalledTimes ( 0 ) ;
2521
+ } else {
2522
+ expect ( onEvent ) . toHaveBeenCalledTimes ( 2 ) ;
2523
+ }
2524
+
2505
2525
document . body . removeChild ( container ) ;
2506
2526
} ) ;
2507
2527
@@ -2581,7 +2601,16 @@ describe('ReactDOMServerPartialHydration', () => {
2581
2601
await promise ;
2582
2602
} ) ;
2583
2603
2584
- expect ( clicks ) . toBe ( 0 ) ;
2604
+ if (
2605
+ gate (
2606
+ flags =>
2607
+ flags . enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ,
2608
+ )
2609
+ ) {
2610
+ expect ( clicks ) . toBe ( 0 ) ;
2611
+ } else {
2612
+ expect ( clicks ) . toBe ( 2 ) ;
2613
+ }
2585
2614
2586
2615
document . body . removeChild ( container ) ;
2587
2616
} ) ;
@@ -2666,7 +2695,17 @@ describe('ReactDOMServerPartialHydration', () => {
2666
2695
resolve ( ) ;
2667
2696
await promise ;
2668
2697
} ) ;
2669
- expect ( onEvent ) . toHaveBeenCalledTimes ( 0 ) ;
2698
+ if (
2699
+ gate (
2700
+ flags =>
2701
+ flags . enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ,
2702
+ )
2703
+ ) {
2704
+ expect ( onEvent ) . toHaveBeenCalledTimes ( 0 ) ;
2705
+ } else {
2706
+ expect ( onEvent ) . toHaveBeenCalledTimes ( 2 ) ;
2707
+ }
2708
+
2670
2709
document . body . removeChild ( container ) ;
2671
2710
} ) ;
2672
2711
@@ -2737,8 +2776,19 @@ describe('ReactDOMServerPartialHydration', () => {
2737
2776
await promise ;
2738
2777
} ) ;
2739
2778
2740
- expect ( clicksOnChild ) . toBe ( 0 ) ;
2741
- expect ( clicksOnParent ) . toBe ( 0 ) ;
2779
+ if (
2780
+ gate (
2781
+ flags =>
2782
+ flags . enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ,
2783
+ )
2784
+ ) {
2785
+ expect ( clicksOnChild ) . toBe ( 0 ) ;
2786
+ expect ( clicksOnParent ) . toBe ( 0 ) ;
2787
+ } else {
2788
+ expect ( clicksOnChild ) . toBe ( 1 ) ;
2789
+ // This will be zero due to the stopPropagation.
2790
+ expect ( clicksOnParent ) . toBe ( 0 ) ;
2791
+ }
2742
2792
2743
2793
document . body . removeChild ( container ) ;
2744
2794
} ) ;
@@ -2814,7 +2864,16 @@ describe('ReactDOMServerPartialHydration', () => {
2814
2864
} ) ;
2815
2865
2816
2866
// We're now full hydrated.
2817
- expect ( clicks ) . toBe ( 0 ) ;
2867
+ if (
2868
+ gate (
2869
+ flags =>
2870
+ flags . enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ,
2871
+ )
2872
+ ) {
2873
+ expect ( clicks ) . toBe ( 0 ) ;
2874
+ } else {
2875
+ expect ( clicks ) . toBe ( 1 ) ;
2876
+ }
2818
2877
2819
2878
document . body . removeChild ( parentContainer ) ;
2820
2879
} ) ;
@@ -3083,9 +3142,19 @@ describe('ReactDOMServerPartialHydration', () => {
3083
3142
await promise ;
3084
3143
} ) ;
3085
3144
3086
- // discrete event not replayed
3087
- expect ( submits ) . toBe ( 0 ) ;
3088
- expect ( container . textContent ) . toBe ( 'Click meHello' ) ;
3145
+ if (
3146
+ gate (
3147
+ flags =>
3148
+ flags . enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay ,
3149
+ )
3150
+ ) {
3151
+ // discrete event not replayed
3152
+ expect ( submits ) . toBe ( 0 ) ;
3153
+ expect ( container . textContent ) . toBe ( 'Click meHello' ) ;
3154
+ } else {
3155
+ expect ( submits ) . toBe ( 1 ) ;
3156
+ expect ( container . textContent ) . toBe ( 'Hello' ) ;
3157
+ }
3089
3158
3090
3159
document . body . removeChild ( container ) ;
3091
3160
} ) ;
0 commit comments