@samitouri / QOS-React-2 / commits / 86715efa23

Resolve the true entry point during tests (#21505)

* Resolve the entry point for tests the same way builds do This way the source tests, test the same entry point configuration. * Gate test selectors on www These are currently only exposed in www builds * Gate createEventHandle / useFocus on www These are enabled in both www variants but not OSS experimental. * Temporarily disable www-modern entry point Use the main one that has all the exports until we fix more tests. * Remove enableCache override that's no longer correct * Open gates for www These used to not be covered because they used Cache which wasn't exposed.

Sebastian Markbåge committed Jun 2, 2021 at 21:03 UTC 86715efa23c02dd156e61a4476f28045bb5f4654
26 files changed +223 -205
packages/react-dom/src/__tests__/ReactDOMFiberAsync-test.js
+3 -3
@@ -286,7 +286,7 @@ describe('ReactDOMFiberAsync', () => {
286 expect(ops).toEqual(['BC', 'ABCD']);
287 });
288
289 - // @gate experimental
289 + // @gate experimental || www
290 it('flushControlled flushes updates before yielding to browser', () => {
291 let inst;
292 class Counter extends React.Component {
@@ -326,7 +326,7 @@ describe('ReactDOMFiberAsync', () => {
326 ]);
327 });
328
329 - // @gate experimental
329 + // @gate experimental || www
330 it('flushControlled does not flush until end of outermost batchedUpdates', () => {
331 let inst;
332 class Counter extends React.Component {
@@ -357,7 +357,7 @@ describe('ReactDOMFiberAsync', () => {
357 ]);
358 });
359
360 - // @gate experimental
360 + // @gate experimental || www
361 it('flushControlled returns nothing', () => {
362 // In the future, we may want to return a thenable "work" object.
363 let inst;
packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js
+6 -6
@@ -571,7 +571,7 @@ describe('ReactDOMServerPartialHydration', () => {
571 expect(span.className).toBe('hi');
572 });
573
574 - // @gate experimental
574 + // @gate experimental || www
575 it('blocks updates to hydrate the content first if props changed at idle priority', async () => {
576 let suspend = false;
577 let resolve;
@@ -1498,7 +1498,7 @@ describe('ReactDOMServerPartialHydration', () => {
1498 expect(container.textContent).toBe('ALoading B');
1499 });
1500
1501 - // @gate experimental
1501 + // @gate experimental || www
1502 it('clears server boundaries when SuspenseList runs out of time hydrating', async () => {
1503 let suspend = false;
1504 let resolve;
@@ -1912,7 +1912,7 @@ describe('ReactDOMServerPartialHydration', () => {
1912 document.body.removeChild(container);
1913 });
1914
1915 - // @gate experimental
1915 + // @gate www
1916 it('does not invoke an event on a hydrated event handle until it commits', async () => {
1917 const setClick = ReactDOM.unstable_createEventHandle('click');
1918 let suspend = false;
@@ -2077,7 +2077,7 @@ describe('ReactDOMServerPartialHydration', () => {
2077 document.body.removeChild(container);
2078 });
2079
2080 - // @gate experimental
2080 + // @gate www
2081 it('invokes discrete events on nested suspense boundaries in a root (createEventHandle)', async () => {
2082 let suspend = false;
2083 let isServerRendering = true;
@@ -2617,7 +2617,7 @@ describe('ReactDOMServerPartialHydration', () => {
2617 expect(span.innerHTML).toBe('Hidden child');
2618 });
2619
2620 - // @gate experimental
2620 + // @gate experimental || www
2621 it('renders a hidden LegacyHidden component inside a Suspense boundary', async () => {
2622 const ref = React.createRef();
2623
@@ -2646,7 +2646,7 @@ describe('ReactDOMServerPartialHydration', () => {
2646 expect(span.innerHTML).toBe('Hidden child');
2647 });
2648
2649 - // @gate experimental
2649 + // @gate experimental || www
2650 it('renders a visible LegacyHidden component', async () => {
2651 const ref = React.createRef();
2652
packages/react-dom/src/__tests__/ReactDOMServerSelectiveHydration-test.internal.js
+5 -5
@@ -369,7 +369,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
369 document.body.removeChild(container);
370 });
371
372 - // @gate experimental
372 + // @gate www
373 it('hydrates the target boundary synchronously during a click (createEventHandle)', async () => {
374 const setClick = ReactDOM.unstable_createEventHandle('click');
375 let isServerRendering = true;
@@ -438,7 +438,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
438 document.body.removeChild(container);
439 });
440
441 - // @gate experimental
441 + // @gate www
442 it('hydrates at higher pri if sync did not work first time (createEventHandle)', async () => {
443 let suspend = false;
444 let isServerRendering = true;
@@ -526,7 +526,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
526 document.body.removeChild(container);
527 });
528
529 - // @gate experimental
529 + // @gate www
530 it('hydrates at higher pri for secondary discrete events (createEventHandle)', async () => {
531 const setClick = ReactDOM.unstable_createEventHandle('click');
532 let suspend = false;
@@ -812,7 +812,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
812 document.body.removeChild(container);
813 });
814
815 - // @gate experimental
815 + // @gate experimental || www
816 it('hydrates the last explicitly hydrated target at higher priority', async () => {
817 function Child({text}) {
818 Scheduler.unstable_yieldValue(text);
@@ -861,7 +861,7 @@ describe('ReactDOMServerSelectiveHydration', () => {
861 expect(Scheduler).toFlushAndYield(['App', 'C', 'B', 'A']);
862 });
863
864 - // @gate experimental
864 + // @gate experimental || www
865 it('hydrates before an update even if hydration moves away from it', async () => {
866 function Child({text}) {
867 Scheduler.unstable_yieldValue(text);
packages/react-dom/src/__tests__/ReactDOMTestSelectors-test.internal.js
+37 -1
@@ -56,6 +56,7 @@ describe('ReactDOMTestSelectors', () => {
56 });
57
58 describe('findAllNodes', () => {
59 + // @gate www
60 it('should support searching from the document root', () => {
61 function Example() {
62 return (
@@ -75,6 +76,7 @@ describe('ReactDOMTestSelectors', () => {
76 expect(matches[0].id).toBe('match');
77 });
78
79 + // @gate www
80 it('should support searching from the container', () => {
81 function Example() {
82 return (
@@ -94,6 +96,7 @@ describe('ReactDOMTestSelectors', () => {
96 expect(matches[0].id).toBe('match');
97 });
98
99 + // @gate www
100 it('should support searching from a previous match if the match had a data-testname', () => {
101 function Outer() {
102 return (
@@ -124,6 +127,7 @@ describe('ReactDOMTestSelectors', () => {
127 expect(matches[0].id).toBe('inner');
128 });
129
130 + // @gate www
131 it('should not support searching from a previous match if the match did not have a data-testname', () => {
132 function Outer() {
133 return (
@@ -153,6 +157,7 @@ describe('ReactDOMTestSelectors', () => {
157 );
158 });
159
160 + // @gate www
161 it('should support an multiple component types in the selector array', () => {
162 function Outer() {
163 return (
@@ -206,6 +211,7 @@ describe('ReactDOMTestSelectors', () => {
211 expect(matches[0].id).toBe('match3');
212 });
213
214 + // @gate www
215 it('should find multiple matches', () => {
216 function Example1() {
217 return (
@@ -243,6 +249,7 @@ describe('ReactDOMTestSelectors', () => {
249 ]);
250 });
251
252 + // @gate www
253 it('should ignore nested matches', () => {
254 function Example() {
255 return (
@@ -262,6 +269,7 @@ describe('ReactDOMTestSelectors', () => {
269 expect(matches[0].id).toEqual('match1');
270 });
271
272 + // @gate www
273 it('should enforce the specific order of selectors', () => {
274 function Outer() {
275 return (
@@ -286,6 +294,7 @@ describe('ReactDOMTestSelectors', () => {
294 ).toHaveLength(0);
295 });
296
297 + // @gate www
298 it('should not search within hidden subtrees', () => {
299 const ref1 = React.createRef(null);
300 const ref2 = React.createRef(null);
@@ -315,6 +324,7 @@ describe('ReactDOMTestSelectors', () => {
324 expect(matches[0]).toBe(ref2.current);
325 });
326
327 + // @gate www
328 it('should support filtering by display text', () => {
329 function Example() {
330 return (
@@ -337,6 +347,7 @@ describe('ReactDOMTestSelectors', () => {
347 expect(matches[0].id).toBe('match');
348 });
349
350 + // @gate www
351 it('should support filtering by explicit accessibiliy role', () => {
352 function Example() {
353 return (
@@ -361,6 +372,7 @@ describe('ReactDOMTestSelectors', () => {
372 expect(matches[0].id).toBe('match');
373 });
374
375 + // @gate www
376 it('should support filtering by explicit secondary accessibiliy role', () => {
377 const ref = React.createRef();
378
@@ -385,6 +397,7 @@ describe('ReactDOMTestSelectors', () => {
397 expect(matches[0]).toBe(ref.current);
398 });
399
400 + // @gate www
401 it('should support filtering by implicit accessibiliy role', () => {
402 function Example() {
403 return (
@@ -407,6 +420,7 @@ describe('ReactDOMTestSelectors', () => {
420 expect(matches[0].id).toBe('match');
421 });
422
423 + // @gate www
424 it('should support filtering by implicit accessibiliy role with attributes qualifications', () => {
425 function Example() {
426 return (
@@ -429,6 +443,7 @@ describe('ReactDOMTestSelectors', () => {
443 expect(matches[0].id).toBe('match');
444 });
445
446 + // @gate www
447 it('should support searching ahead with the has() selector', () => {
448 function Example() {
449 return (
@@ -464,12 +479,14 @@ describe('ReactDOMTestSelectors', () => {
479 expect(matches[0].id).toBe('match');
480 });
481
482 + // @gate www
483 it('should throw if no container can be found', () => {
484 expect(() => findAllNodes(document.body, [])).toThrow(
485 'Could not find React container within specified host subtree.',
486 );
487 });
488
489 + // @gate www
490 it('should throw if an invalid host root is specified', () => {
491 const ref = React.createRef();
492 function Example() {
@@ -485,6 +502,7 @@ describe('ReactDOMTestSelectors', () => {
502 });
503
504 describe('getFindAllNodesFailureDescription', () => {
505 + // @gate www
506 it('should describe findAllNodes failures caused by the component type selector', () => {
507 function Outer() {
508 return <Middle />;
@@ -514,6 +532,7 @@ No matching component was found for:
532 );
533 });
534
535 + // @gate www
536 it('should return null if findAllNodes was able to find a match', () => {
537 function Example() {
538 return (
@@ -549,6 +568,7 @@ No matching component was found for:
568 };
569 }
570
571 + // @gate www
572 it('should return a single rect for a component that returns a single root host element', () => {
573 const ref = React.createRef();
574
@@ -582,6 +602,7 @@ No matching component was found for:
602 });
603 });
604
605 + // @gate www
606 it('should return a multiple rects for multiple matches', () => {
607 const outerRef = React.createRef();
608 const innerRef = React.createRef();
@@ -631,6 +652,7 @@ No matching component was found for:
652 });
653 });
654
655 + // @gate www
656 it('should return a multiple rects for single match that returns a fragment', () => {
657 const refA = React.createRef();
658 const refB = React.createRef();
@@ -680,6 +702,7 @@ No matching component was found for:
702 });
703 });
704
705 + // @gate www
706 it('should merge overlapping rects', () => {
707 const refA = React.createRef();
708 const refB = React.createRef();
@@ -734,6 +757,7 @@ No matching component was found for:
757 });
758 });
759
760 + // @gate www
761 it('should merge some types of adjacent rects (if they are the same in one dimension)', () => {
762 const refA = React.createRef();
763 const refB = React.createRef();
@@ -833,6 +857,7 @@ No matching component was found for:
857 });
858 });
859
860 + // @gate www
861 it('should not search within hidden subtrees', () => {
862 const refA = React.createRef();
863 const refB = React.createRef();
@@ -889,6 +914,7 @@ No matching component was found for:
914 });
915
916 describe('focusWithin', () => {
917 + // @gate www
918 it('should return false if the specified component path has no matches', () => {
919 function Example() {
920 return <Child />;
@@ -909,6 +935,7 @@ No matching component was found for:
935 expect(didFocus).toBe(false);
936 });
937
938 + // @gate www
939 it('should return false if there are no focusable elements within the matched subtree', () => {
940 function Example() {
941 return <Child />;
@@ -926,6 +953,7 @@ No matching component was found for:
953 expect(didFocus).toBe(false);
954 });
955
956 + // @gate www
957 it('should return false if the only focusable elements are disabled', () => {
958 function Example() {
959 return (
@@ -943,6 +971,7 @@ No matching component was found for:
971 expect(didFocus).toBe(false);
972 });
973
974 + // @gate www
975 it('should return false if the only focusable elements are hidden', () => {
976 function Example() {
977 return <button hidden={true}>not clickable</button>;
@@ -956,6 +985,7 @@ No matching component was found for:
985 expect(didFocus).toBe(false);
986 });
987
988 + // @gate www
989 it('should successfully focus the first focusable element within the tree', () => {
990 const secondRef = React.createRef(null);
991
@@ -1010,6 +1040,7 @@ No matching component was found for:
1040 expect(handleThirdFocus).not.toHaveBeenCalled();
1041 });
1042
1043 + // @gate www
1044 it('should successfully focus the first focusable element even if application logic interferes', () => {
1045 const ref = React.createRef(null);
1046
@@ -1039,6 +1070,7 @@ No matching component was found for:
1070 expect(handleFocus).toHaveBeenCalledTimes(1);
1071 });
1072
1073 + // @gate www
1074 it('should not focus within hidden subtrees', () => {
1075 const secondRef = React.createRef(null);
1076
@@ -1162,6 +1194,7 @@ No matching component was found for:
1194 window.IntersectionObserver = IntersectionObserver;
1195 });
1196
1197 + // @gate www
1198 it('should notify a listener when the underlying instance intersection changes', () => {
1199 const ref = React.createRef(null);
1200
@@ -1198,6 +1231,7 @@ No matching component was found for:
1231 expect(handleVisibilityChange).toHaveBeenCalledWith([{rect, ratio: 0.5}]);
1232 });
1233
1234 + // @gate www
1235 it('should notify a listener of multiple targets when the underlying instance intersection changes', () => {
1236 const ref1 = React.createRef(null);
1237 const ref2 = React.createRef(null);
@@ -1274,6 +1308,7 @@ No matching component was found for:
1308 ]);
1309 });
1310
1311 + // @gate www
1312 it('should stop listening when its disconnected', () => {
1313 const ref = React.createRef(null);
1314
@@ -1308,7 +1343,7 @@ No matching component was found for:
1343 });
1344
1345 // This test reuires gating because it relies on the __DEV__ only commit hook to work.
1311 - // @gate __DEV__
1346 + // @gate www && __DEV__
1347 it('should update which targets its listening to after a commit', () => {
1348 const ref1 = React.createRef(null);
1349 const ref2 = React.createRef(null);
@@ -1387,6 +1422,7 @@ No matching component was found for:
1422 ]);
1423 });
1424
1425 + // @gate www
1426 it('should not observe components within hidden subtrees', () => {
1427 const ref1 = React.createRef(null);
1428 const ref2 = React.createRef(null);
packages/react-dom/src/__tests__/ReactUpdates-test.js
+1 -1
@@ -1300,7 +1300,7 @@ describe('ReactUpdates', () => {
1300 expect(ops).toEqual(['Foo', 'Bar', 'Baz']);
1301 });
1302
1303 - // @gate experimental
1303 + // @gate experimental || www
1304 it('delays sync updates inside hidden subtrees in Concurrent Mode', () => {
1305 const container = document.createElement('div');
1306
packages/react-dom/src/__tests__/ReactWrongReturnPointer-test.js
-1
@@ -194,7 +194,6 @@ test('warns in DEV if return pointer is inconsistent', async () => {
194 );
195 });
196
197 -// @gate experimental
197 // @gate enableCache
198 test('regression (#20932): return pointer is correct before entering deleted tree', async () => {
199 // Based on a production bug. Designed to trigger a very specific
packages/react-dom/src/events/__tests__/DOMPluginEventSystem-test.internal.js
+34 -34
@@ -1257,7 +1257,7 @@ describe('DOMPluginEventSystem', () => {
1257 act = ReactTestUtils.unstable_concurrentAct;
1258 });
1259
1260 - // @gate experimental
1260 + // @gate www
1261 it('can render correctly with the ReactDOMServer', () => {
1262 const clickEvent = jest.fn();
1263 const setClick = ReactDOM.unstable_createEventHandle('click');
@@ -1275,7 +1275,7 @@ describe('DOMPluginEventSystem', () => {
1275 expect(output).toBe(`<div>Hello world</div>`);
1276 });
1277
1278 - // @gate experimental
1278 + // @gate www
1279 it('can render correctly with the ReactDOMServer hydration', () => {
1280 const clickEvent = jest.fn();
1281 const spanRef = React.createRef();
@@ -1301,7 +1301,7 @@ describe('DOMPluginEventSystem', () => {
1301 expect(clickEvent).toHaveBeenCalledTimes(1);
1302 });
1303
1304 - // @gate experimental
1304 + // @gate www
1305 it('should correctly work for a basic "click" listener', () => {
1306 let log = [];
1307 const clickEvent = jest.fn(event => {
@@ -1409,7 +1409,7 @@ describe('DOMPluginEventSystem', () => {
1409 expect(clickEvent2).toBeCalledTimes(1);
1410 });
1411
1412 - // @gate experimental
1412 + // @gate www
1413 it('should correctly work for setting and clearing a basic "click" listener', () => {
1414 const clickEvent = jest.fn();
1415 const divRef = React.createRef();
@@ -1450,7 +1450,7 @@ describe('DOMPluginEventSystem', () => {
1450 expect(clickEvent).toBeCalledTimes(0);
1451 });
1452
1453 - // @gate experimental
1453 + // @gate www
1454 it('should handle the target being a text node', () => {
1455 const clickEvent = jest.fn();
1456 const buttonRef = React.createRef();
@@ -1472,7 +1472,7 @@ describe('DOMPluginEventSystem', () => {
1472 expect(clickEvent).toBeCalledTimes(1);
1473 });
1474
1475 - // @gate experimental
1475 + // @gate www
1476 it('handle propagation of click events', () => {
1477 const buttonRef = React.createRef();
1478 const divRef = React.createRef();
@@ -1541,7 +1541,7 @@ describe('DOMPluginEventSystem', () => {
1541 expect(log[3]).toEqual(['bubble', buttonElement]);
1542 });
1543
1544 - // @gate experimental
1544 + // @gate www
1545 it('handle propagation of click events mixed with onClick events', () => {
1546 const buttonRef = React.createRef();
1547 const divRef = React.createRef();
@@ -1601,7 +1601,7 @@ describe('DOMPluginEventSystem', () => {
1601 expect(log[5]).toEqual(['bubble', buttonElement]);
1602 });
1603
1604 - // @gate experimental
1604 + // @gate www
1605 it('should correctly work for a basic "click" listener on the outer target', () => {
1606 const log = [];
1607 const clickEvent = jest.fn(event => {
@@ -1666,7 +1666,7 @@ describe('DOMPluginEventSystem', () => {
1666 expect(clickEvent).toBeCalledTimes(2);
1667 });
1668
1669 - // @gate experimental
1669 + // @gate www
1670 it('should correctly handle many nested target listeners', () => {
1671 const buttonRef = React.createRef();
1672 const targetListener1 = jest.fn();
@@ -1769,7 +1769,7 @@ describe('DOMPluginEventSystem', () => {
1769 expect(targetListener4).toHaveBeenCalledTimes(2);
1770 });
1771
1772 - // @gate experimental
1772 + // @gate www
1773 it('should correctly handle stopPropagation correctly for target events', () => {
1774 const buttonRef = React.createRef();
1775 const divRef = React.createRef();
@@ -1807,7 +1807,7 @@ describe('DOMPluginEventSystem', () => {
1807 expect(clickEvent).toHaveBeenCalledTimes(0);
1808 });
1809
1810 - // @gate experimental
1810 + // @gate www
1811 it('should correctly handle stopPropagation correctly for many target events', () => {
1812 const buttonRef = React.createRef();
1813 const targetListener1 = jest.fn(e => e.stopPropagation());
@@ -1860,7 +1860,7 @@ describe('DOMPluginEventSystem', () => {
1860 expect(targetListener4).toHaveBeenCalledTimes(1);
1861 });
1862
1863 - // @gate experimental
1863 + // @gate www
1864 it('should correctly handle stopPropagation for mixed capture/bubbling target listeners', () => {
1865 const buttonRef = React.createRef();
1866 const targetListener1 = jest.fn(e => e.stopPropagation());
@@ -1917,7 +1917,7 @@ describe('DOMPluginEventSystem', () => {
1917 expect(targetListener4).toHaveBeenCalledTimes(0);
1918 });
1919
1920 - // @gate experimental
1920 + // @gate www
1921 it('should work with concurrent mode updates', async () => {
1922 const log = [];
1923 const ref = React.createRef();
@@ -1970,7 +1970,7 @@ describe('DOMPluginEventSystem', () => {
1970 expect(log).toEqual([{counter: 1}]);
1971 });
1972
1973 - // @gate experimental
1973 + // @gate www
1974 it('should correctly work for a basic "click" window listener', () => {
1975 const log = [];
1976 const clickEvent = jest.fn(event => {
@@ -2021,7 +2021,7 @@ describe('DOMPluginEventSystem', () => {
2021 expect(clickEvent).toBeCalledTimes(2);
2022 });
2023
2024 - // @gate experimental
2024 + // @gate www
2025 it('handle propagation of click events on the window', () => {
2026 const buttonRef = React.createRef();
2027 const divRef = React.createRef();
@@ -2101,7 +2101,7 @@ describe('DOMPluginEventSystem', () => {
2101 expect(log[5]).toEqual(['bubble', window]);
2102 });
2103
2104 - // @gate experimental
2104 + // @gate www
2105 it('should correctly handle stopPropagation for mixed listeners', () => {
2106 const buttonRef = React.createRef();
2107 const rootListener1 = jest.fn(e => e.stopPropagation());
@@ -2152,7 +2152,7 @@ describe('DOMPluginEventSystem', () => {
2152 expect(rootListener2).toHaveBeenCalledTimes(0);
2153 });
2154
2155 - // @gate experimental
2155 + // @gate www
2156 it('should correctly handle stopPropagation for delegated listeners', () => {
2157 const buttonRef = React.createRef();
2158 const rootListener1 = jest.fn(e => e.stopPropagation());
@@ -2198,7 +2198,7 @@ describe('DOMPluginEventSystem', () => {
2198 expect(rootListener4).toHaveBeenCalledTimes(0);
2199 });
2200
2201 - // @gate experimental
2201 + // @gate www
2202 it('handle propagation of click events on the window and document', () => {
2203 const buttonRef = React.createRef();
2204 const divRef = React.createRef();
@@ -2311,7 +2311,7 @@ describe('DOMPluginEventSystem', () => {
2311 }
2312 });
2313
2314 - // @gate experimental
2314 + // @gate www
2315 it('does not support custom user events', () => {
2316 // With eager listeners, supporting custom events via this API doesn't make sense
2317 // because we can't know a full list of them ahead of time. Let's check we throw
@@ -2323,7 +2323,7 @@ describe('DOMPluginEventSystem', () => {
2323 );
2324 });
2325
2326 - // @gate experimental
2326 + // @gate www
2327 it('beforeblur and afterblur are called after a focused element is unmounted', () => {
2328 const log = [];
2329 // We have to persist here because we want to read relatedTarget later.
@@ -2382,7 +2382,7 @@ describe('DOMPluginEventSystem', () => {
2382 expect(log).toEqual(['beforeblur', 'afterblur']);
2383 });
2384
2385 - // @gate experimental
2385 + // @gate www
2386 it('beforeblur and afterblur are called after a nested focused element is unmounted', () => {
2387 const log = [];
2388 // We have to persist here because we want to read relatedTarget later.
@@ -2445,7 +2445,7 @@ describe('DOMPluginEventSystem', () => {
2445 expect(log).toEqual(['beforeblur', 'afterblur']);
2446 });
2447
2448 - // @gate experimental
2448 + // @gate www
2449 it('beforeblur should skip handlers from a deleted subtree after the focused element is unmounted', () => {
2450 const onBeforeBlur = jest.fn();
2451 const innerRef = React.createRef();
@@ -2499,7 +2499,7 @@ describe('DOMPluginEventSystem', () => {
2499 expect(onBeforeBlur).toHaveBeenCalledTimes(1);
2500 });
2501
2502 - // @gate experimental
2502 + // @gate www
2503 it('beforeblur and afterblur are called after a focused element is suspended', () => {
2504 const log = [];
2505 // We have to persist here because we want to read relatedTarget later.
@@ -2585,7 +2585,7 @@ describe('DOMPluginEventSystem', () => {
2585 document.body.removeChild(container2);
2586 });
2587
2588 - // @gate experimental
2588 + // @gate www
2589 it('beforeblur should skip handlers from a deleted subtree after the focused element is suspended', () => {
2590 const onBeforeBlur = jest.fn();
2591 const innerRef = React.createRef();
@@ -2666,7 +2666,7 @@ describe('DOMPluginEventSystem', () => {
2666 document.body.removeChild(container2);
2667 });
2668
2669 - // @gate experimental
2669 + // @gate www
2670 it('regression: does not fire beforeblur/afterblur if target is already hidden', () => {
2671 const Suspense = React.Suspense;
2672 let suspend = false;
@@ -2728,7 +2728,7 @@ describe('DOMPluginEventSystem', () => {
2728 document.body.removeChild(container2);
2729 });
2730
2731 - // @gate experimental
2731 + // @gate www
2732 it('handle propagation of click events between disjointed comment roots', () => {
2733 const buttonRef = React.createRef();
2734 const divRef = React.createRef();
@@ -2799,7 +2799,7 @@ describe('DOMPluginEventSystem', () => {
2799 expect(log[5]).toEqual(['bubble', buttonElement]);
2800 });
2801
2802 - // @gate experimental
2802 + // @gate www
2803 it('propagates known createEventHandle events through portals without inner listeners', () => {
2804 const buttonRef = React.createRef();
2805 const divRef = React.createRef();
@@ -2870,7 +2870,7 @@ describe('DOMPluginEventSystem', () => {
2870 ReactDOMServer = require('react-dom/server');
2871 });
2872
2873 - // @gate experimental
2873 + // @gate www
2874 it('handle propagation of click events on a scope', () => {
2875 const buttonRef = React.createRef();
2876 const log = [];
@@ -2926,7 +2926,7 @@ describe('DOMPluginEventSystem', () => {
2926 ]);
2927 });
2928
2929 - // @gate experimental
2929 + // @gate www
2930 it('handle mixed propagation of click events on a scope', () => {
2931 const buttonRef = React.createRef();
2932 const divRef = React.createRef();
@@ -3017,7 +3017,7 @@ describe('DOMPluginEventSystem', () => {
3017 ]);
3018 });
3019
3020 - // @gate experimental
3020 + // @gate www
3021 it('should not handle the target being a dangling text node within a scope', () => {
3022 const clickEvent = jest.fn();
3023 const buttonRef = React.createRef();
@@ -3048,7 +3048,7 @@ describe('DOMPluginEventSystem', () => {
3048 expect(clickEvent).toBeCalledTimes(0);
3049 });
3050
3051 - // @gate experimental
3051 + // @gate www
3052 it('handle stopPropagation (inner) correctly between scopes', () => {
3053 const buttonRef = React.createRef();
3054 const outerOnClick = jest.fn();
@@ -3090,7 +3090,7 @@ describe('DOMPluginEventSystem', () => {
3090 expect(outerOnClick).toHaveBeenCalledTimes(0);
3091 });
3092
3093 - // @gate experimental
3093 + // @gate www
3094 it('handle stopPropagation (outer) correctly between scopes', () => {
3095 const buttonRef = React.createRef();
3096 const outerOnClick = jest.fn(e => e.stopPropagation());
@@ -3132,7 +3132,7 @@ describe('DOMPluginEventSystem', () => {
3132 expect(outerOnClick).toHaveBeenCalledTimes(1);
3133 });
3134
3135 - // @gate experimental
3135 + // @gate www
3136 it('handle stopPropagation (inner and outer) correctly between scopes', () => {
3137 const buttonRef = React.createRef();
3138 const onClick = jest.fn(e => e.stopPropagation());
@@ -3172,7 +3172,7 @@ describe('DOMPluginEventSystem', () => {
3172 expect(onClick).toHaveBeenCalledTimes(1);
3173 });
3174
3175 - // @gate experimental
3175 + // @gate www
3176 it('should be able to register handlers for events affected by the intervention', () => {
3177 const rootContainer = document.createElement('div');
3178 container.appendChild(rootContainer);
packages/react-fetch/src/__tests__/ReactFetchNode-test.js
+5 -5
@@ -39,7 +39,7 @@ describe('ReactFetchNode', () => {
39 server = null;
40 });
41
42 - // @gate experimental
42 + // @gate experimental || www
43 it('can fetch text from a server component', async () => {
44 serverImpl = (req, res) => {
45 res.write('mango');
@@ -51,7 +51,7 @@ describe('ReactFetchNode', () => {
51 expect(text).toEqual('mango');
52 });
53
54 - // @gate experimental
54 + // @gate experimental || www
55 it('can fetch json from a server component', async () => {
56 serverImpl = (req, res) => {
57 res.write(JSON.stringify({name: 'Sema'}));
@@ -63,7 +63,7 @@ describe('ReactFetchNode', () => {
63 expect(json).toEqual({name: 'Sema'});
64 });
65
66 - // @gate experimental
66 + // @gate experimental || www
67 it('provides response status', async () => {
68 serverImpl = (req, res) => {
69 res.write(JSON.stringify({name: 'Sema'}));
@@ -79,7 +79,7 @@ describe('ReactFetchNode', () => {
79 });
80 });
81
82 - // @gate experimental
82 + // @gate experimental || www
83 it('handles different paths', async () => {
84 serverImpl = (req, res) => {
85 switch (req.url) {
@@ -105,7 +105,7 @@ describe('ReactFetchNode', () => {
105 expect(outputs).toMatchObject(['banana', 'mango', 'orange']);
106 });
107
108 - // @gate experimental
108 + // @gate experimental || www
109 it('can produce an error', async () => {
110 serverImpl = (req, res) => {};
111
packages/react-interactions/events/src/dom/create-event-handle/__tests__/useFocus-test.internal.js
+12 -12
@@ -28,7 +28,7 @@ function initializeModules(hasPointerEvents) {
28
29 // TODO: This import throws outside of experimental mode. Figure out better
30 // strategy for gated imports.
31 - if (__EXPERIMENTAL__) {
31 + if (__EXPERIMENTAL__ || global.__WWW__) {
32 useFocus = require('react-interactions/events/focus').useFocus;
33 }
34 }
@@ -70,7 +70,7 @@ describe.each(table)(`useFocus hasPointerEvents=%s`, hasPointerEvents => {
70 Scheduler.unstable_flushAll();
71 };
72
73 - // @gate experimental
73 + // @gate www
74 it('does not call callbacks', () => {
75 componentInit();
76 const target = createEventTarget(ref.current);
@@ -97,7 +97,7 @@ describe.each(table)(`useFocus hasPointerEvents=%s`, hasPointerEvents => {
97 Scheduler.unstable_flushAll();
98 };
99
100 - // @gate experimental
100 + // @gate www
101 it('is called after "blur" event', () => {
102 componentInit();
103 const target = createEventTarget(ref.current);
@@ -128,7 +128,7 @@ describe.each(table)(`useFocus hasPointerEvents=%s`, hasPointerEvents => {
128 Scheduler.unstable_flushAll();
129 };
130
131 - // @gate experimental
131 + // @gate www
132 it('is called after "focus" event', () => {
133 componentInit();
134 const target = createEventTarget(ref.current);
@@ -136,7 +136,7 @@ describe.each(table)(`useFocus hasPointerEvents=%s`, hasPointerEvents => {
136 expect(onFocus).toHaveBeenCalledTimes(1);
137 });
138
139 - // @gate experimental
139 + // @gate www
140 it('is not called if descendants of target receive focus', () => {
141 componentInit();
142 const target = createEventTarget(innerRef.current);
@@ -166,7 +166,7 @@ describe.each(table)(`useFocus hasPointerEvents=%s`, hasPointerEvents => {
166 Scheduler.unstable_flushAll();
167 };
168
169 - // @gate experimental
169 + // @gate www
170 it('is called after "blur" and "focus" events', () => {
171 componentInit();
172 const target = createEventTarget(ref.current);
@@ -178,7 +178,7 @@ describe.each(table)(`useFocus hasPointerEvents=%s`, hasPointerEvents => {
178 expect(onFocusChange).toHaveBeenCalledWith(false);
179 });
180
181 - // @gate experimental
181 + // @gate www
182 it('is not called after "blur" and "focus" events on descendants', () => {
183 componentInit();
184 const target = createEventTarget(innerRef.current);
@@ -210,7 +210,7 @@ describe.each(table)(`useFocus hasPointerEvents=%s`, hasPointerEvents => {
210 Scheduler.unstable_flushAll();
211 };
212
213 - // @gate experimental
213 + // @gate www
214 it('is called after "focus" and "blur" if keyboard navigation is active', () => {
215 componentInit();
216 const target = createEventTarget(ref.current);
@@ -225,7 +225,7 @@ describe.each(table)(`useFocus hasPointerEvents=%s`, hasPointerEvents => {
225 expect(onFocusVisibleChange).toHaveBeenCalledWith(false);
226 });
227
228 - // @gate experimental
228 + // @gate www
229 it('is called if non-keyboard event is dispatched on target previously focused with keyboard', () => {
230 componentInit();
231 const target = createEventTarget(ref.current);
@@ -244,7 +244,7 @@ describe.each(table)(`useFocus hasPointerEvents=%s`, hasPointerEvents => {
244 expect(onFocusVisibleChange).toHaveBeenCalledTimes(2);
245 });
246
247 - // @gate experimental
247 + // @gate www
248 it('is not called after "focus" and "blur" events without keyboard', () => {
249 componentInit();
250 const target = createEventTarget(ref.current);
@@ -256,7 +256,7 @@ describe.each(table)(`useFocus hasPointerEvents=%s`, hasPointerEvents => {
256 expect(onFocusVisibleChange).toHaveBeenCalledTimes(0);
257 });
258
259 - // @gate experimental
259 + // @gate www
260 it('is not called after "blur" and "focus" events on descendants', () => {
261 componentInit();
262 const innerTarget = createEventTarget(innerRef.current);
@@ -270,7 +270,7 @@ describe.each(table)(`useFocus hasPointerEvents=%s`, hasPointerEvents => {
270 });
271
272 describe('nested Focus components', () => {
273 - // @gate experimental
273 + // @gate www
274 it('propagates events in the correct order', () => {
275 const events = [];
276 const innerRef = React.createRef();
packages/react-interactions/events/src/dom/create-event-handle/__tests__/useFocusWithin-test.internal.js
+17 -17
@@ -33,7 +33,7 @@ function initializeModules(hasPointerEvents) {
33
34 // TODO: This import throws outside of experimental mode. Figure out better
35 // strategy for gated imports.
36 - if (__EXPERIMENTAL__) {
36 + if (__EXPERIMENTAL__ || global.__WWW__) {
37 useFocusWithin = require('react-interactions/events/focus').useFocusWithin;
38 }
39 }
@@ -80,7 +80,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
80 Scheduler.unstable_flushAll();
81 };
82
83 - // @gate experimental
83 + // @gate www
84 it('prevents custom events being dispatched', () => {
85 componentInit();
86 const target = createEventTarget(ref.current);
@@ -115,7 +115,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
115 Scheduler.unstable_flushAll();
116 };
117
118 - // @gate experimental
118 + // @gate www
119 it('is called after "blur" and "focus" events on focus target', () => {
120 componentInit();
121 const target = createEventTarget(ref.current);
@@ -127,7 +127,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
127 expect(onFocusWithinChange).toHaveBeenCalledWith(false);
128 });
129
130 - // @gate experimental
130 + // @gate www
131 it('is called after "blur" and "focus" events on descendants', () => {
132 componentInit();
133 const target = createEventTarget(innerRef.current);
@@ -139,7 +139,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
139 expect(onFocusWithinChange).toHaveBeenCalledWith(false);
140 });
141
142 - // @gate experimental
142 + // @gate www
143 it('is only called once when focus moves within and outside the subtree', () => {
144 componentInit();
145 const node = ref.current;
@@ -191,7 +191,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
191 Scheduler.unstable_flushAll();
192 };
193
194 - // @gate experimental
194 + // @gate www
195 it('is called after "focus" and "blur" on focus target if keyboard was used', () => {
196 componentInit();
197 const target = createEventTarget(ref.current);
@@ -206,7 +206,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
206 expect(onFocusWithinVisibleChange).toHaveBeenCalledWith(false);
207 });
208
209 - // @gate experimental
209 + // @gate www
210 it('is called after "focus" and "blur" on descendants if keyboard was used', () => {
211 componentInit();
212 const innerTarget = createEventTarget(innerRef.current);
@@ -221,7 +221,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
221 expect(onFocusWithinVisibleChange).toHaveBeenCalledWith(false);
222 });
223
224 - // @gate experimental
224 + // @gate www
225 it('is called if non-keyboard event is dispatched on target previously focused with keyboard', () => {
226 componentInit();
227 const node = ref.current;
@@ -259,7 +259,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
259 expect(onFocusWithinVisibleChange).toHaveBeenCalledTimes(4);
260 });
261
262 - // @gate experimental
262 + // @gate www
263 it('is not called after "focus" and "blur" events without keyboard', () => {
264 componentInit();
265 const innerTarget = createEventTarget(innerRef.current);
@@ -269,7 +269,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
269 expect(onFocusWithinVisibleChange).toHaveBeenCalledTimes(0);
270 });
271
272 - // @gate experimental
272 + // @gate www
273 it('is only called once when focus moves within and outside the subtree', () => {
274 componentInit();
275 const node = ref.current;
@@ -297,7 +297,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
297 });
298 });
299
300 - // @gate experimental
300 + // @gate www
301 it('should correctly handle focus visibility when typing into an input', () => {
302 const onFocusWithinVisibleChange = jest.fn();
303 const ref = React.createRef();
@@ -337,7 +337,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
337 innerRef2 = React.createRef();
338 });
339
340 - // @gate experimental
340 + // @gate www
341 it('is called after a focused element is unmounted', () => {
342 const Component = ({show}) => {
343 const focusWithinRef = useFocusWithin(ref, {
@@ -369,7 +369,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
369 );
370 });
371
372 - // @gate experimental
372 + // @gate www
373 it('is called after a nested focused element is unmounted', () => {
374 const Component = ({show}) => {
375 const focusWithinRef = useFocusWithin(ref, {
@@ -405,7 +405,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
405 );
406 });
407
408 - // @gate experimental
408 + // @gate www
409 it('is called after many elements are unmounted', () => {
410 const buttonRef = React.createRef();
411 const inputRef = React.createRef();
@@ -440,7 +440,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
440 expect(onAfterBlurWithin).toHaveBeenCalledTimes(1);
441 });
442
443 - // @gate experimental
443 + // @gate www
444 it('is called after a nested focused element is unmounted (with scope query)', () => {
445 const TestScope = React.unstable_Scope;
446 const testScopeQuery = (type, props) => true;
@@ -476,7 +476,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
476 expect(targetNodes).toEqual([targetNode]);
477 });
478
479 - // @gate experimental
479 + // @gate www
480 it('is called after a focused suspended element is hidden', () => {
481 const Suspense = React.Suspense;
482 let suspend = false;
@@ -534,7 +534,7 @@ describe.each(table)(`useFocus`, hasPointerEvents => {
534 resolve();
535 });
536
537 - // @gate experimental
537 + // @gate www
538 it('is called after a focused suspended element is hidden then shown', () => {
539 const Suspense = React.Suspense;
540 let suspend = false;
packages/react-reconciler/src/__tests__/DebugTracing-test.internal.js
+3 -3
@@ -43,7 +43,7 @@ describe('DebugTracing', () => {
43 });
44 });
45
46 - // @gate experimental
46 + // @gate experimental || www
47 it('should not log anything for sync render without suspends or state updates', () => {
48 ReactTestRenderer.create(
49 <React.unstable_DebugTracingMode>
@@ -54,7 +54,7 @@ describe('DebugTracing', () => {
54 expect(logs).toEqual([]);
55 });
56
57 - // @gate experimental
57 + // @gate experimental || www
58 it('should not log anything for concurrent render without suspends or state updates', () => {
59 ReactTestRenderer.create(
60 <React.unstable_DebugTracingMode>
@@ -396,7 +396,7 @@ describe('DebugTracing', () => {
396 ]);
397 });
398
399 - // @gate experimental
399 + // @gate experimental || www
400 it('should not log anything outside of a unstable_DebugTracingMode subtree', () => {
401 function ExampleThatCascades() {
402 const [didMount, setDidMount] = React.useState(false);
packages/react-reconciler/src/__tests__/ReactCache-test.js
+16 -16
@@ -149,7 +149,7 @@ describe('ReactCache', () => {
149 }
150 }
151
152 - // @gate experimental
152 + // @gate experimental || www
153 test('render Cache component', async () => {
154 const root = ReactNoop.createRoot();
155 await ReactNoop.act(async () => {
@@ -158,7 +158,7 @@ describe('ReactCache', () => {
158 expect(root).toMatchRenderedOutput('Hi');
159 });
160
161 - // @gate experimental
161 + // @gate experimental || www
162 test('mount new data', async () => {
163 const root = ReactNoop.createRoot();
164 await ReactNoop.act(async () => {
@@ -180,7 +180,7 @@ describe('ReactCache', () => {
180 expect(root).toMatchRenderedOutput('A');
181 });
182
183 - // @gate experimental
183 + // @gate experimental || www
184 test('root acts as implicit cache boundary', async () => {
185 const root = ReactNoop.createRoot();
186 await ReactNoop.act(async () => {
@@ -200,7 +200,7 @@ describe('ReactCache', () => {
200 expect(root).toMatchRenderedOutput('A');
201 });
202
203 - // @gate experimental
203 + // @gate experimental || www
204 test('multiple new Cache boundaries in the same update share the same, fresh cache', async () => {
205 function App({text}) {
206 return (
@@ -239,7 +239,7 @@ describe('ReactCache', () => {
239 expect(root).toMatchRenderedOutput('AA');
240 });
241
242 - // @gate experimental
242 + // @gate experimental || www
243 test(
244 'nested cache boundaries share the same cache as the root during ' +
245 'the initial render',
@@ -272,7 +272,7 @@ describe('ReactCache', () => {
272 },
273 );
274
275 - // @gate experimental
275 + // @gate experimental || www
276 test('new content inside an existing Cache boundary should re-use already cached data', async () => {
277 function App({showMore}) {
278 return (
@@ -309,7 +309,7 @@ describe('ReactCache', () => {
309 expect(root).toMatchRenderedOutput('A [v1]A [v1]');
310 });
311
312 - // @gate experimental
312 + // @gate experimental || www
313 test('a new Cache boundary uses fresh cache', async () => {
314 // The only difference from the previous test is that the "Show More"
315 // content is wrapped in a nested <Cache /> boundary
@@ -356,7 +356,7 @@ describe('ReactCache', () => {
356 expect(root).toMatchRenderedOutput('A [v1]A [v2]');
357 });
358
359 - // @gate experimental
359 + // @gate experimental || www
360 test('inner content uses same cache as shell if spawned by the same transition', async () => {
361 const root = ReactNoop.createRoot();
362
@@ -431,7 +431,7 @@ describe('ReactCache', () => {
431 );
432 });
433
434 - // @gate experimental
434 + // @gate experimental || www
435 test('refresh a cache', async () => {
436 let refresh;
437 function App() {
@@ -474,7 +474,7 @@ describe('ReactCache', () => {
474 expect(root).toMatchRenderedOutput('A [v2]');
475 });
476
477 - // @gate experimental
477 + // @gate experimental || www
478 test('refresh the root cache', async () => {
479 let refresh;
480 function App() {
@@ -515,7 +515,7 @@ describe('ReactCache', () => {
515 expect(root).toMatchRenderedOutput('A [v2]');
516 });
517
518 - // @gate experimental
518 + // @gate experimental || www
519 test('refresh a cache with seed data', async () => {
520 let refresh;
521 function App() {
@@ -558,7 +558,7 @@ describe('ReactCache', () => {
558 expect(root).toMatchRenderedOutput('A [v2]');
559 });
560
561 - // @gate experimental
561 + // @gate experimental || www
562 test('refreshing a parent cache also refreshes its children', async () => {
563 let refreshShell;
564 function RefreshShell() {
@@ -623,7 +623,7 @@ describe('ReactCache', () => {
623 expect(root).toMatchRenderedOutput('A [v3]A [v3]');
624 });
625
626 - // @gate experimental
626 + // @gate experimental || www
627 test(
628 'refreshing a cache boundary does not refresh the other boundaries ' +
629 'that mounted at the same time (i.e. the ones that share the same cache)',
@@ -696,7 +696,7 @@ describe('ReactCache', () => {
696 },
697 );
698
699 - // @gate experimental
699 + // @gate experimental || www
700 test(
701 'mount a new Cache boundary in a sibling while simultaneously ' +
702 'resolving a Suspense boundary',
@@ -758,7 +758,7 @@ describe('ReactCache', () => {
758 },
759 );
760
761 - // @gate experimental
761 + // @gate experimental || www
762 test('cache pool is cleared once transitions that depend on it commit their shell', async () => {
763 function Child({text}) {
764 return (
@@ -841,7 +841,7 @@ describe('ReactCache', () => {
841 expect(root).toMatchRenderedOutput('A [v1]A [v1]A [v2]');
842 });
843
844 - // @gate experimental
844 + // @gate experimental || www
845 test('cache pool is not cleared by arbitrary commits', async () => {
846 function App() {
847 return (
packages/react-reconciler/src/__tests__/ReactContextPropagation-test.js
+3 -4
@@ -542,7 +542,7 @@ describe('ReactLazyContextPropagation', () => {
542 expect(root).toMatchRenderedOutput('BB');
543 });
544
545 - // @gate experimental
545 + // @gate experimental || www
546 test('context is propagated through offscreen trees', async () => {
547 const LegacyHidden = React.unstable_LegacyHidden;
548
@@ -588,7 +588,7 @@ describe('ReactLazyContextPropagation', () => {
588 expect(root).toMatchRenderedOutput('BB');
589 });
590
591 - // @gate experimental
591 + // @gate experimental || www
592 test('multiple contexts are propagated across through offscreen trees', async () => {
593 // Same as previous test, but with multiple context providers
594 const LegacyHidden = React.unstable_LegacyHidden;
@@ -744,7 +744,6 @@ describe('ReactLazyContextPropagation', () => {
744 expect(root).toMatchRenderedOutput('BB');
745 });
746
747 - // @gate experimental
747 // @gate enableCache
748 test('nested bailouts across retries', async () => {
749 // Lazy context propagation will stop propagating when it hits the first
@@ -814,7 +813,7 @@ describe('ReactLazyContextPropagation', () => {
813 expect(root).toMatchRenderedOutput('BB');
814 });
815
817 - // @gate experimental
816 + // @gate experimental || www
817 test('nested bailouts through offscreen trees', async () => {
818 // Lazy context propagation will stop propagating when it hits the first
819 // match. If we bail out again inside that tree, we must resume propagating.
packages/react-reconciler/src/__tests__/ReactIncremental-test.js
+3 -3
@@ -270,7 +270,7 @@ describe('ReactIncremental', () => {
270 expect(inst.state).toEqual({text: 'bar', text2: 'baz'});
271 });
272
273 - // @gate experimental
273 + // @gate experimental || www
274 it('can deprioritize unfinished work and resume it later', () => {
275 function Bar(props) {
276 Scheduler.unstable_yieldValue('Bar');
@@ -316,7 +316,7 @@ describe('ReactIncremental', () => {
316 expect(Scheduler).toFlushAndYield(['Middle', 'Middle']);
317 });
318
319 - // @gate experimental
319 + // @gate experimental || www
320 it('can deprioritize a tree from without dropping work', () => {
321 function Bar(props) {
322 Scheduler.unstable_yieldValue('Bar');
@@ -1999,7 +1999,7 @@ describe('ReactIncremental', () => {
1999 });
2000 }
2001
2002 - // @gate experimental
2002 + // @gate experimental || www
2003 it('provides context when reusing work', () => {
2004 class Intl extends React.Component {
2005 static childContextTypes = {
packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js
+1 -1
@@ -308,7 +308,7 @@ describe('ReactIncrementalErrorHandling', () => {
308 expect(ReactNoop.getChildren()).toEqual([span('Everything is fine.')]);
309 });
310
311 - // @gate experimental
311 + // @gate experimental || www
312 it('does not include offscreen work when retrying after an error', () => {
313 function App(props) {
314 if (props.isBroken) {
packages/react-reconciler/src/__tests__/ReactIncrementalSideEffects-test.js
+5 -5
@@ -424,7 +424,7 @@ describe('ReactIncrementalSideEffects', () => {
424 ]);
425 });
426
427 - // @gate experimental
427 + // @gate experimental || www
428 it('preserves a previously rendered node when deprioritized', () => {
429 function Middle(props) {
430 Scheduler.unstable_yieldValue('Middle');
@@ -475,7 +475,7 @@ describe('ReactIncrementalSideEffects', () => {
475 );
476 });
477
478 - // @gate experimental
478 + // @gate experimental || www
479 it('can reuse side-effects after being preempted', () => {
480 function Bar(props) {
481 Scheduler.unstable_yieldValue('Bar');
@@ -555,7 +555,7 @@ describe('ReactIncrementalSideEffects', () => {
555 );
556 });
557
558 - // @gate experimental
558 + // @gate experimental || www
559 it('can reuse side-effects after being preempted, if shouldComponentUpdate is false', () => {
560 class Bar extends React.Component {
561 shouldComponentUpdate(nextProps) {
@@ -690,7 +690,7 @@ describe('ReactIncrementalSideEffects', () => {
690 expect(ReactNoop.getChildrenAsJSX()).toEqual(<span prop={3} />);
691 });
692
693 - // @gate experimental
693 + // @gate experimental || www
694 it('updates a child even though the old props is empty', () => {
695 function Foo(props) {
696 return (
@@ -930,7 +930,7 @@ describe('ReactIncrementalSideEffects', () => {
930 expect(ops).toEqual(['Bar', 'Baz', 'Bar', 'Bar']);
931 });
932
933 - // @gate experimental
933 + // @gate experimental || www
934 it('deprioritizes setStates that happens within a deprioritized tree', () => {
935 const barInstances = [];
936
packages/react-reconciler/src/__tests__/ReactNewContext-test.js
+1 -1
@@ -667,7 +667,7 @@ describe('ReactNewContext', () => {
667 expect(ReactNoop.getChildren()).toEqual([span(2), span(2)]);
668 });
669
670 - // @gate experimental
670 + // @gate experimental || www
671 it("context consumer doesn't bail out inside hidden subtree", () => {
672 const Context = React.createContext('dark');
673 const Consumer = getConsumer(Context);
packages/react-reconciler/src/__tests__/ReactOffscreen-test.js
+6 -6
@@ -24,7 +24,7 @@ describe('ReactOffscreen', () => {
24 return <span prop={props.text} />;
25 }
26
27 - // @gate experimental
27 + // @gate experimental || www
28 it('unstable-defer-without-hiding should never toggle the visibility of its children', async () => {
29 function App({mode}) {
30 return (
@@ -83,7 +83,7 @@ describe('ReactOffscreen', () => {
83 );
84 });
85
86 - // @gate experimental
86 + // @gate experimental || www
87 it('does not defer in legacy mode', async () => {
88 let setState;
89 function Foo() {
@@ -128,7 +128,7 @@ describe('ReactOffscreen', () => {
128 );
129 });
130
131 - // @gate experimental
131 + // @gate experimental || www
132 it('does defer in concurrent mode', async () => {
133 let setState;
134 function Foo() {
@@ -174,7 +174,7 @@ describe('ReactOffscreen', () => {
174 );
175 });
176
177 - // @gate experimental
177 + // @gate experimental || www
178 // @gate enableSuspenseLayoutEffectSemantics
179 it('mounts without layout effects when hidden', async () => {
180 function Child({text}) {
@@ -216,7 +216,7 @@ describe('ReactOffscreen', () => {
216 expect(root).toMatchRenderedOutput(<span prop="Child" />);
217 });
218
219 - // @gate experimental
219 + // @gate experimental || www
220 // @gate enableSuspenseLayoutEffectSemantics
221 it('mounts/unmounts layout effects when visibility changes (starting visible)', async () => {
222 function Child({text}) {
@@ -266,7 +266,7 @@ describe('ReactOffscreen', () => {
266 expect(root).toMatchRenderedOutput(<span prop="Child" />);
267 });
268
269 - // @gate experimental
269 + // @gate experimental || www
270 // @gate enableSuspenseLayoutEffectSemantics
271 it('mounts/unmounts layout effects when visibility changes (starting hidden)', async () => {
272 function Child({text}) {
packages/react-reconciler/src/__tests__/ReactSchedulerIntegration-test.js
+1 -1
@@ -120,7 +120,7 @@ describe('ReactSchedulerIntegration', () => {
120 expect(Scheduler).toHaveYielded(['A', 'B', 'C']);
121 });
122
123 - // @gate experimental
123 + // @gate experimental || www
124 it('idle updates are not blocked by offscreen work', async () => {
125 function Text({text}) {
126 Scheduler.unstable_yieldValue(text);
packages/react-reconciler/src/__tests__/ReactScope-test.internal.js
+10 -10
@@ -39,7 +39,7 @@ describe('ReactScope', () => {
39 container = null;
40 });
41
42 - // @gate experimental
42 + // @gate www
43 it('DO_NOT_USE_queryAllNodes() works as intended', () => {
44 const testScopeQuery = (type, props) => true;
45 const TestScope = React.unstable_Scope;
@@ -74,7 +74,7 @@ describe('ReactScope', () => {
74 expect(scopeRef.current).toBe(null);
75 });
76
77 - // @gate experimental
77 + // @gate www
78 it('DO_NOT_USE_queryAllNodes() provides the correct host instance', () => {
79 const testScopeQuery = (type, props) => type === 'div';
80 const TestScope = React.unstable_Scope;
@@ -121,7 +121,7 @@ describe('ReactScope', () => {
121 expect(scopeRef.current).toBe(null);
122 });
123
124 - // @gate experimental
124 + // @gate www
125 it('DO_NOT_USE_queryFirstNode() works as intended', () => {
126 const testScopeQuery = (type, props) => true;
127 const TestScope = React.unstable_Scope;
@@ -156,7 +156,7 @@ describe('ReactScope', () => {
156 expect(scopeRef.current).toBe(null);
157 });
158
159 - // @gate experimental
159 + // @gate www
160 it('containsNode() works as intended', () => {
161 const TestScope = React.unstable_Scope;
162 const scopeRef = React.createRef();
@@ -206,7 +206,7 @@ describe('ReactScope', () => {
206 expect(scopeRef.current.containsNode(emRef.current)).toBe(false);
207 });
208
209 - // @gate experimental
209 + // @gate www
210 it('scopes support server-side rendering and hydration', () => {
211 const TestScope = React.unstable_Scope;
212 const scopeRef = React.createRef();
@@ -237,7 +237,7 @@ describe('ReactScope', () => {
237 expect(nodes).toEqual([divRef.current, spanRef.current, aRef.current]);
238 });
239
240 - // @gate experimental
240 + // @gate www
241 it('getChildContextValues() works as intended', () => {
242 const TestContext = React.createContext();
243 const TestScope = React.unstable_Scope;
@@ -266,7 +266,7 @@ describe('ReactScope', () => {
266 expect(scopeRef.current).toBe(null);
267 });
268
269 - // @gate experimental
269 + // @gate www
270 it('correctly works with suspended boundaries that are hydrated', async () => {
271 let suspend = false;
272 let resolve;
@@ -341,7 +341,7 @@ describe('ReactScope', () => {
341 ReactTestRenderer = require('react-test-renderer');
342 });
343
344 - // @gate experimental
344 + // @gate www
345 it('DO_NOT_USE_queryAllNodes() works as intended', () => {
346 const testScopeQuery = (type, props) => true;
347 const TestScope = React.unstable_Scope;
@@ -378,7 +378,7 @@ describe('ReactScope', () => {
378 expect(nodes).toEqual([aRef.current, divRef.current, spanRef.current]);
379 });
380
381 - // @gate experimental
381 + // @gate www
382 it('DO_NOT_USE_queryFirstNode() works as intended', () => {
383 const testScopeQuery = (type, props) => true;
384 const TestScope = React.unstable_Scope;
@@ -415,7 +415,7 @@ describe('ReactScope', () => {
415 expect(node).toEqual(aRef.current);
416 });
417
418 - // @gate experimental
418 + // @gate www
419 it('containsNode() works as intended', () => {
420 const TestScope = React.unstable_Scope;
421 const scopeRef = React.createRef();
packages/react-reconciler/src/__tests__/ReactSubtreeFlagsWarning-test.js
+1 -1
@@ -124,7 +124,7 @@ describe('ReactSuspenseWithNoopRenderer', () => {
124
125 const resolveText = resolveMostRecentTextCache;
126
127 - // @gate experimental
127 + // @gate experimental || www
128 it('regression: false positive for legacy suspense', async () => {
129 // Wrapping in memo because regular function components go through the
130 // mountIndeterminateComponent path, which acts like there's no `current`
scripts/jest/TestFlags.js
-5
@@ -81,11 +81,6 @@ function getTestFlags() {
81
82 ...featureFlags,
83 ...environmentFlags,
84 -
85 - // FIXME: www-classic has enableCache on, but when running the source
86 - // tests, Jest doesn't expose the API correctly. Fix then remove
87 - // this override.
88 - enableCache: __EXPERIMENTAL__,
84 },
85 {
86 get(flags, flagName) {
scripts/jest/config.source-persistent.js
-21
@@ -2,28 +2,7 @@
2
3 const baseConfig = require('./config.base');
4
5 -const RELEASE_CHANNEL = process.env.RELEASE_CHANNEL;
6 -
7 -// Default to building in experimental mode. If the release channel is set via
8 -// an environment variable, then check if it's "experimental".
9 -const __EXPERIMENTAL__ =
10 - typeof RELEASE_CHANNEL === 'string'
11 - ? RELEASE_CHANNEL === 'experimental'
12 - : true;
13 -
14 -const preferredExtension = __EXPERIMENTAL__ ? '.js' : '.stable.js';
15 -
16 -const moduleNameMapper = {};
17 -moduleNameMapper[
18 - '^react$'
19 -] = `<rootDir>/packages/react/index${preferredExtension}`;
20 -moduleNameMapper[
21 - '^react-dom$'
22 -] = `<rootDir>/packages/react-dom/index${preferredExtension}`;
23 -
5 module.exports = Object.assign({}, baseConfig, {
25 - // Prefer the stable forks for tests.
26 - moduleNameMapper,
6 modulePathIgnorePatterns: [
7 ...baseConfig.modulePathIgnorePatterns,
8 'packages/react-devtools-shared',
scripts/jest/config.source-www.js
-21
@@ -2,28 +2,7 @@
2
3 const baseConfig = require('./config.base');
4
5 -const RELEASE_CHANNEL = process.env.RELEASE_CHANNEL;
6 -
7 -// Default to building in experimental mode. If the release channel is set via
8 -// an environment variable, then check if it's "experimental".
9 -const __EXPERIMENTAL__ =
10 - typeof RELEASE_CHANNEL === 'string'
11 - ? RELEASE_CHANNEL === 'experimental'
12 - : true;
13 -
14 -const preferredExtension = __EXPERIMENTAL__ ? '.js' : '.stable.js';
15 -
16 -const moduleNameMapper = {};
17 -moduleNameMapper[
18 - '^react$'
19 -] = `<rootDir>/packages/react/index${preferredExtension}`;
20 -moduleNameMapper[
21 - '^react-dom$'
22 -] = `<rootDir>/packages/react-dom/index${preferredExtension}`;
23 -
5 module.exports = Object.assign({}, baseConfig, {
25 - // Prefer the stable forks for tests.
26 - moduleNameMapper,
6 modulePathIgnorePatterns: [
7 ...baseConfig.modulePathIgnorePatterns,
8 'packages/react-devtools-shared',
scripts/jest/config.source.js
-21
@@ -2,28 +2,7 @@
2
3 const baseConfig = require('./config.base');
4
5 -const RELEASE_CHANNEL = process.env.RELEASE_CHANNEL;
6 -
7 -// Default to building in experimental mode. If the release channel is set via
8 -// an environment variable, then check if it's "experimental".
9 -const __EXPERIMENTAL__ =
10 - typeof RELEASE_CHANNEL === 'string'
11 - ? RELEASE_CHANNEL === 'experimental'
12 - : true;
13 -
14 -const preferredExtension = __EXPERIMENTAL__ ? '.js' : '.stable.js';
15 -
16 -const moduleNameMapper = {};
17 -moduleNameMapper[
18 - '^react$'
19 -] = `<rootDir>/packages/react/index${preferredExtension}`;
20 -moduleNameMapper[
21 - '^react-dom$'
22 -] = `<rootDir>/packages/react-dom/index${preferredExtension}`;
23 -
5 module.exports = Object.assign({}, baseConfig, {
25 - // Prefer the stable forks for tests.
26 - moduleNameMapper,
6 modulePathIgnorePatterns: [
7 ...baseConfig.modulePathIgnorePatterns,
8 'packages/react-devtools-shared',
scripts/jest/setupHostConfigs.js
+53 -1
@@ -1,7 +1,55 @@
1 'use strict';
2
3 +const fs = require('fs');
4 const inlinedHostConfigs = require('../shared/inlinedHostConfigs');
5
6 +function resolveEntryFork(resolvedEntry, isFBBundle) {
7 + // Pick which entry point fork to use:
8 + // .modern.fb.js
9 + // .classic.fb.js
10 + // .fb.js
11 + // .stable.js
12 + // .experimental.js
13 + // .js
14 +
15 + if (isFBBundle) {
16 + if (__EXPERIMENTAL__) {
17 + // We can't currently use the true modern entry point because too many tests fail.
18 + // TODO: Fix tests to not use ReactDOM.render or gate them. Then we can remove this.
19 + return resolvedEntry;
20 + }
21 + const resolvedFBEntry = resolvedEntry.replace(
22 + '.js',
23 + __EXPERIMENTAL__ ? '.modern.fb.js' : '.classic.fb.js'
24 + );
25 + if (fs.existsSync(resolvedFBEntry)) {
26 + return resolvedFBEntry;
27 + }
28 + const resolvedGenericFBEntry = resolvedEntry.replace('.js', '.fb.js');
29 + if (fs.existsSync(resolvedGenericFBEntry)) {
30 + return resolvedGenericFBEntry;
31 + }
32 + // Even if it's a FB bundle we fallthrough to pick stable or experimental if we don't have an FB fork.
33 + }
34 + const resolvedForkedEntry = resolvedEntry.replace(
35 + '.js',
36 + __EXPERIMENTAL__ ? '.experimental.js' : '.stable.js'
37 + );
38 + if (fs.existsSync(resolvedForkedEntry)) {
39 + return resolvedForkedEntry;
40 + }
41 + // Just use the plain .js one.
42 + return resolvedEntry;
43 +}
44 +
45 +jest.mock('react', () => {
46 + const resolvedEntryPoint = resolveEntryFork(
47 + require.resolve('react'),
48 + global.__WWW__
49 + );
50 + return jest.requireActual(resolvedEntryPoint);
51 +});
52 +
53 jest.mock('react-reconciler/src/ReactFiberReconciler', () => {
54 return jest.requireActual(
55 __VARIANT__
@@ -85,7 +133,11 @@ inlinedHostConfigs.forEach(rendererInfo => {
133 rendererInfo.entryPoints.forEach(entryPoint => {
134 jest.mock(entryPoint, () => {
135 mockAllConfigs(rendererInfo);
88 - return jest.requireActual(entryPoint);
136 + const resolvedEntryPoint = resolveEntryFork(
137 + require.resolve(entryPoint),
138 + global.__WWW__
139 + );
140 + return jest.requireActual(resolvedEntryPoint);
141 });
142 });
143 });