@@ -2415,8 +2415,18 @@ describe('ReactDOMServerPartialHydration', () => {
24152415 await promise ;
24162416 } ) ;
24172417
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+ }
24202430 document . body . removeChild ( container ) ;
24212431 } ) ;
24222432
@@ -2498,7 +2508,17 @@ describe('ReactDOMServerPartialHydration', () => {
24982508 await promise ;
24992509 } ) ;
25002510
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+
25022522 document . body . removeChild ( container ) ;
25032523 } ) ;
25042524
@@ -2578,7 +2598,16 @@ describe('ReactDOMServerPartialHydration', () => {
25782598 await promise ;
25792599 } ) ;
25802600
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+ }
25822611
25832612 document . body . removeChild ( container ) ;
25842613 } ) ;
@@ -2663,7 +2692,17 @@ describe('ReactDOMServerPartialHydration', () => {
26632692 resolve ( ) ;
26642693 await promise ;
26652694 } ) ;
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+
26672706 document . body . removeChild ( container ) ;
26682707 } ) ;
26692708
@@ -2734,8 +2773,19 @@ describe('ReactDOMServerPartialHydration', () => {
27342773 await promise ;
27352774 } ) ;
27362775
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+ }
27392789
27402790 document . body . removeChild ( container ) ;
27412791 } ) ;
@@ -2811,7 +2861,16 @@ describe('ReactDOMServerPartialHydration', () => {
28112861 } ) ;
28122862
28132863 // 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+ }
28152874
28162875 document . body . removeChild ( parentContainer ) ;
28172876 } ) ;
@@ -3080,9 +3139,19 @@ describe('ReactDOMServerPartialHydration', () => {
30803139 await promise ;
30813140 } ) ;
30823141
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+ }
30863155
30873156 document . body . removeChild ( container ) ;
30883157 } ) ;
0 commit comments