@@ -1905,10 +1905,19 @@ describe('ReactDOMServerPartialHydration', () => { |
1905 | 1905 | resolve(); |
1906 | 1906 | await promise; |
1907 | 1907 | }); |
1908 | | - expect(clicks).toBe(1); |
1909 | | - |
1910 | | - expect(container.textContent).toBe('Hello'); |
1911 | 1908 |
|
| 1909 | + if ( |
| 1910 | + gate( |
| 1911 | + flags => |
| 1912 | + flags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay, |
| 1913 | + ) |
| 1914 | + ) { |
| 1915 | + expect(clicks).toBe(0); |
| 1916 | + expect(container.textContent).toBe('Click meHello'); |
| 1917 | + } else { |
| 1918 | + expect(clicks).toBe(1); |
| 1919 | + expect(container.textContent).toBe('Hello'); |
| 1920 | + } |
1912 | 1921 | document.body.removeChild(container); |
1913 | 1922 | }); |
1914 | 1923 |
|
@@ -1991,7 +2000,16 @@ describe('ReactDOMServerPartialHydration', () => { |
1991 | 2000 | await promise; |
1992 | 2001 | }); |
1993 | 2002 |
|
1994 | | - expect(onEvent).toHaveBeenCalledTimes(2); |
| 2003 | + if ( |
| 2004 | + gate( |
| 2005 | + flags => |
| 2006 | + flags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay, |
| 2007 | + ) |
| 2008 | + ) { |
| 2009 | + expect(onEvent).toHaveBeenCalledTimes(0); |
| 2010 | + } else { |
| 2011 | + expect(onEvent).toHaveBeenCalledTimes(2); |
| 2012 | + } |
1995 | 2013 |
|
1996 | 2014 | document.body.removeChild(container); |
1997 | 2015 | }); |
@@ -2072,7 +2090,17 @@ describe('ReactDOMServerPartialHydration', () => { |
2072 | 2090 | resolve(); |
2073 | 2091 | await promise; |
2074 | 2092 | }); |
2075 | | - expect(clicks).toBe(2); |
| 2093 | + |
| 2094 | + if ( |
| 2095 | + gate( |
| 2096 | + flags => |
| 2097 | + flags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay, |
| 2098 | + ) |
| 2099 | + ) { |
| 2100 | + expect(clicks).toBe(0); |
| 2101 | + } else { |
| 2102 | + expect(clicks).toBe(2); |
| 2103 | + } |
2076 | 2104 |
|
2077 | 2105 | document.body.removeChild(container); |
2078 | 2106 | }); |
@@ -2158,7 +2186,16 @@ describe('ReactDOMServerPartialHydration', () => { |
2158 | 2186 | resolve(); |
2159 | 2187 | await promise; |
2160 | 2188 | }); |
2161 | | - expect(onEvent).toHaveBeenCalledTimes(2); |
| 2189 | + if ( |
| 2190 | + gate( |
| 2191 | + flags => |
| 2192 | + flags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay, |
| 2193 | + ) |
| 2194 | + ) { |
| 2195 | + expect(onEvent).toHaveBeenCalledTimes(0); |
| 2196 | + } else { |
| 2197 | + expect(onEvent).toHaveBeenCalledTimes(2); |
| 2198 | + } |
2162 | 2199 |
|
2163 | 2200 | document.body.removeChild(container); |
2164 | 2201 | }); |
@@ -2231,9 +2268,19 @@ describe('ReactDOMServerPartialHydration', () => { |
2231 | 2268 | await promise; |
2232 | 2269 | }); |
2233 | 2270 |
|
2234 | | - expect(clicksOnChild).toBe(1); |
2235 | | - // This will be zero due to the stopPropagation. |
2236 | | - expect(clicksOnParent).toBe(0); |
| 2271 | + if ( |
| 2272 | + gate( |
| 2273 | + flags => |
| 2274 | + flags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay, |
| 2275 | + ) |
| 2276 | + ) { |
| 2277 | + expect(clicksOnChild).toBe(0); |
| 2278 | + expect(clicksOnParent).toBe(0); |
| 2279 | + } else { |
| 2280 | + expect(clicksOnChild).toBe(1); |
| 2281 | + // This will be zero due to the stopPropagation. |
| 2282 | + expect(clicksOnParent).toBe(0); |
| 2283 | + } |
2237 | 2284 |
|
2238 | 2285 | document.body.removeChild(container); |
2239 | 2286 | }); |
@@ -2310,8 +2357,16 @@ describe('ReactDOMServerPartialHydration', () => { |
2310 | 2357 | }); |
2311 | 2358 |
|
2312 | 2359 | // We're now full hydrated. |
2313 | | - |
2314 | | - expect(clicks).toBe(1); |
| 2360 | + if ( |
| 2361 | + gate( |
| 2362 | + flags => |
| 2363 | + flags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay, |
| 2364 | + ) |
| 2365 | + ) { |
| 2366 | + expect(clicks).toBe(0); |
| 2367 | + } else { |
| 2368 | + expect(clicks).toBe(1); |
| 2369 | + } |
2315 | 2370 |
|
2316 | 2371 | document.body.removeChild(parentContainer); |
2317 | 2372 | }); |
@@ -2580,8 +2635,20 @@ describe('ReactDOMServerPartialHydration', () => { |
2580 | 2635 | await promise; |
2581 | 2636 | }); |
2582 | 2637 |
|
2583 | | - expect(submits).toBe(1); |
2584 | | - expect(container.textContent).toBe('Hello'); |
| 2638 | + if ( |
| 2639 | + gate( |
| 2640 | + flags => |
| 2641 | + flags.enableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay, |
| 2642 | + ) |
| 2643 | + ) { |
| 2644 | + // discrete event not replayed |
| 2645 | + expect(submits).toBe(0); |
| 2646 | + expect(container.textContent).toBe('Click meHello'); |
| 2647 | + } else { |
| 2648 | + expect(submits).toBe(1); |
| 2649 | + expect(container.textContent).toBe('Hello'); |
| 2650 | + } |
| 2651 | + |
2585 | 2652 | document.body.removeChild(container); |
2586 | 2653 | }); |
2587 | 2654 |
|
|