@@ -370,7 +370,7 @@ describe('ReactSuspense', () => { |
370 | 370 |
|
371 | 371 | await LazyClass; |
372 | 372 |
|
373 | | - expect(Scheduler).toFlushExpired(['Hi', 'Did mount: Hi']); |
| 373 | + expect(Scheduler).toFlushUntilNextPaint(['Hi', 'Did mount: Hi']); |
374 | 374 | expect(root).toMatchRenderedOutput('Hi'); |
375 | 375 | }); |
376 | 376 |
|
@@ -729,7 +729,7 @@ describe('ReactSuspense', () => { |
729 | 729 | jest.advanceTimersByTime(100); |
730 | 730 |
|
731 | 731 | expect(Scheduler).toHaveYielded(['Promise resolved [B:1]']); |
732 | | - expect(Scheduler).toFlushExpired([ |
| 732 | + expect(Scheduler).toFlushUntilNextPaint([ |
733 | 733 | 'B:1', |
734 | 734 | 'Unmount [Loading...]', |
735 | 735 | // Should be a mount, not an update |
@@ -748,7 +748,7 @@ describe('ReactSuspense', () => { |
748 | 748 | jest.advanceTimersByTime(100); |
749 | 749 |
|
750 | 750 | expect(Scheduler).toHaveYielded(['Promise resolved [B:2]']); |
751 | | - expect(Scheduler).toFlushExpired([ |
| 751 | + expect(Scheduler).toFlushUntilNextPaint([ |
752 | 752 | 'B:2', |
753 | 753 | 'Unmount [Loading...]', |
754 | 754 | 'Update [B:2]', |
@@ -786,7 +786,7 @@ describe('ReactSuspense', () => { |
786 | 786 | jest.advanceTimersByTime(1000); |
787 | 787 |
|
788 | 788 | expect(Scheduler).toHaveYielded(['Promise resolved [A]']); |
789 | | - expect(Scheduler).toFlushExpired(['A']); |
| 789 | + expect(Scheduler).toFlushUntilNextPaint(['A']); |
790 | 790 | expect(root).toMatchRenderedOutput('Stateful: 1A'); |
791 | 791 |
|
792 | 792 | root.update(<App text="B" />); |
@@ -804,7 +804,7 @@ describe('ReactSuspense', () => { |
804 | 804 | jest.advanceTimersByTime(1000); |
805 | 805 |
|
806 | 806 | expect(Scheduler).toHaveYielded(['Promise resolved [B]']); |
807 | | - expect(Scheduler).toFlushExpired(['B']); |
| 807 | + expect(Scheduler).toFlushUntilNextPaint(['B']); |
808 | 808 | expect(root).toMatchRenderedOutput('Stateful: 2B'); |
809 | 809 | }); |
810 | 810 |
|
@@ -846,7 +846,7 @@ describe('ReactSuspense', () => { |
846 | 846 | jest.advanceTimersByTime(1000); |
847 | 847 |
|
848 | 848 | expect(Scheduler).toHaveYielded(['Promise resolved [A]']); |
849 | | - expect(Scheduler).toFlushExpired(['A']); |
| 849 | + expect(Scheduler).toFlushUntilNextPaint(['A']); |
850 | 850 | expect(root).toMatchRenderedOutput('Stateful: 1A'); |
851 | 851 |
|
852 | 852 | root.update(<App text="B" />); |
@@ -871,7 +871,7 @@ describe('ReactSuspense', () => { |
871 | 871 | jest.advanceTimersByTime(1000); |
872 | 872 |
|
873 | 873 | expect(Scheduler).toHaveYielded(['Promise resolved [B]']); |
874 | | - expect(Scheduler).toFlushExpired(['B']); |
| 874 | + expect(Scheduler).toFlushUntilNextPaint(['B']); |
875 | 875 | expect(root).toMatchRenderedOutput('Stateful: 2B'); |
876 | 876 | }); |
877 | 877 |
|
@@ -951,7 +951,7 @@ describe('ReactSuspense', () => { |
951 | 951 | jest.advanceTimersByTime(500); |
952 | 952 |
|
953 | 953 | expect(Scheduler).toHaveYielded(['Promise resolved [A]']); |
954 | | - expect(Scheduler).toFlushExpired(['A', 'Did commit: A']); |
| 954 | + expect(Scheduler).toFlushUntilNextPaint(['A', 'Did commit: A']); |
955 | 955 | }); |
956 | 956 |
|
957 | 957 | it('retries when an update is scheduled on a timed out tree', () => { |
@@ -1038,7 +1038,7 @@ describe('ReactSuspense', () => { |
1038 | 1038 | jest.advanceTimersByTime(1000); |
1039 | 1039 |
|
1040 | 1040 | expect(Scheduler).toHaveYielded(['Promise resolved [Child 1]']); |
1041 | | - expect(Scheduler).toFlushExpired([ |
| 1041 | + expect(Scheduler).toFlushUntilNextPaint([ |
1042 | 1042 | 'Child 1', |
1043 | 1043 | 'Suspend! [Child 2]', |
1044 | 1044 | 'Suspend! [Child 3]', |
@@ -1047,12 +1047,15 @@ describe('ReactSuspense', () => { |
1047 | 1047 | jest.advanceTimersByTime(1000); |
1048 | 1048 |
|
1049 | 1049 | expect(Scheduler).toHaveYielded(['Promise resolved [Child 2]']); |
1050 | | - expect(Scheduler).toFlushExpired(['Child 2', 'Suspend! [Child 3]']); |
| 1050 | + expect(Scheduler).toFlushUntilNextPaint([ |
| 1051 | + 'Child 2', |
| 1052 | + 'Suspend! [Child 3]', |
| 1053 | + ]); |
1051 | 1054 |
|
1052 | 1055 | jest.advanceTimersByTime(1000); |
1053 | 1056 |
|
1054 | 1057 | expect(Scheduler).toHaveYielded(['Promise resolved [Child 3]']); |
1055 | | - expect(Scheduler).toFlushExpired(['Child 3']); |
| 1058 | + expect(Scheduler).toFlushUntilNextPaint(['Child 3']); |
1056 | 1059 | expect(root).toMatchRenderedOutput( |
1057 | 1060 | ['Child 1', 'Child 2', 'Child 3'].join(''), |
1058 | 1061 | ); |
@@ -1113,7 +1116,7 @@ describe('ReactSuspense', () => { |
1113 | 1116 | jest.advanceTimersByTime(1000); |
1114 | 1117 |
|
1115 | 1118 | expect(Scheduler).toHaveYielded(['Promise resolved [Tab: 0]']); |
1116 | | - expect(Scheduler).toFlushExpired(['Tab: 0']); |
| 1119 | + expect(Scheduler).toFlushUntilNextPaint(['Tab: 0']); |
1117 | 1120 | expect(root).toMatchRenderedOutput('Tab: 0 + sibling'); |
1118 | 1121 |
|
1119 | 1122 | act(() => setTab(1)); |
@@ -1126,7 +1129,7 @@ describe('ReactSuspense', () => { |
1126 | 1129 | jest.advanceTimersByTime(1000); |
1127 | 1130 |
|
1128 | 1131 | expect(Scheduler).toHaveYielded(['Promise resolved [Tab: 1]']); |
1129 | | - expect(Scheduler).toFlushExpired(['Tab: 1']); |
| 1132 | + expect(Scheduler).toFlushUntilNextPaint(['Tab: 1']); |
1130 | 1133 | expect(root).toMatchRenderedOutput('Tab: 1 + sibling'); |
1131 | 1134 |
|
1132 | 1135 | act(() => setTab(2)); |
@@ -1139,7 +1142,7 @@ describe('ReactSuspense', () => { |
1139 | 1142 | jest.advanceTimersByTime(1000); |
1140 | 1143 |
|
1141 | 1144 | expect(Scheduler).toHaveYielded(['Promise resolved [Tab: 2]']); |
1142 | | - expect(Scheduler).toFlushExpired(['Tab: 2']); |
| 1145 | + expect(Scheduler).toFlushUntilNextPaint(['Tab: 2']); |
1143 | 1146 | expect(root).toMatchRenderedOutput('Tab: 2 + sibling'); |
1144 | 1147 | }); |
1145 | 1148 |
|
@@ -1177,7 +1180,7 @@ describe('ReactSuspense', () => { |
1177 | 1180 | jest.advanceTimersByTime(1000); |
1178 | 1181 |
|
1179 | 1182 | expect(Scheduler).toHaveYielded(['Promise resolved [A:0]']); |
1180 | | - expect(Scheduler).toFlushExpired(['A:0']); |
| 1183 | + expect(Scheduler).toFlushUntilNextPaint(['A:0']); |
1181 | 1184 | expect(root).toMatchRenderedOutput('A:0'); |
1182 | 1185 |
|
1183 | 1186 | act(() => setStep(1)); |
@@ -1215,7 +1218,7 @@ describe('ReactSuspense', () => { |
1215 | 1218 | jest.advanceTimersByTime(1000); |
1216 | 1219 |
|
1217 | 1220 | expect(Scheduler).toHaveYielded(['Promise resolved [A]']); |
1218 | | - expect(Scheduler).toFlushExpired([ |
| 1221 | + expect(Scheduler).toFlushUntilNextPaint([ |
1219 | 1222 | 'A', |
1220 | 1223 | // The promises for B and C have now been thrown twice |
1221 | 1224 | 'Suspend! [B]', |
@@ -1226,7 +1229,7 @@ describe('ReactSuspense', () => { |
1226 | 1229 | jest.advanceTimersByTime(1000); |
1227 | 1230 |
|
1228 | 1231 | expect(Scheduler).toHaveYielded(['Promise resolved [B]']); |
1229 | | - expect(Scheduler).toFlushExpired([ |
| 1232 | + expect(Scheduler).toFlushUntilNextPaint([ |
1230 | 1233 | // Even though the promise for B was thrown twice, we should only |
1231 | 1234 | // re-render once. |
1232 | 1235 | 'B', |
@@ -1238,7 +1241,7 @@ describe('ReactSuspense', () => { |
1238 | 1241 | jest.advanceTimersByTime(1000); |
1239 | 1242 |
|
1240 | 1243 | expect(Scheduler).toHaveYielded(['Promise resolved [C]']); |
1241 | | - expect(Scheduler).toFlushExpired([ |
| 1244 | + expect(Scheduler).toFlushUntilNextPaint([ |
1242 | 1245 | // Even though the promise for C was thrown three times, we should only |
1243 | 1246 | // re-render once. |
1244 | 1247 | 'C', |
@@ -1280,7 +1283,7 @@ describe('ReactSuspense', () => { |
1280 | 1283 | jest.advanceTimersByTime(1000); |
1281 | 1284 |
|
1282 | 1285 | expect(Scheduler).toHaveYielded(['Promise resolved [A]']); |
1283 | | - expect(Scheduler).toFlushExpired([ |
| 1286 | + expect(Scheduler).toFlushUntilNextPaint([ |
1284 | 1287 | 'A', |
1285 | 1288 | // The promises for B and C have now been thrown twice |
1286 | 1289 | 'Suspend! [B]', |
@@ -1291,7 +1294,7 @@ describe('ReactSuspense', () => { |
1291 | 1294 | jest.advanceTimersByTime(1000); |
1292 | 1295 |
|
1293 | 1296 | expect(Scheduler).toHaveYielded(['Promise resolved [B]']); |
1294 | | - expect(Scheduler).toFlushExpired([ |
| 1297 | + expect(Scheduler).toFlushUntilNextPaint([ |
1295 | 1298 | // Even though the promise for B was thrown twice, we should only |
1296 | 1299 | // re-render once. |
1297 | 1300 | 'B', |
@@ -1393,15 +1396,15 @@ describe('ReactSuspense', () => { |
1393 | 1396 | jest.advanceTimersByTime(1000); |
1394 | 1397 |
|
1395 | 1398 | expect(Scheduler).toHaveYielded(['Promise resolved [default]']); |
1396 | | - expect(Scheduler).toFlushExpired(['default']); |
| 1399 | + expect(Scheduler).toFlushUntilNextPaint(['default']); |
1397 | 1400 | expect(root).toMatchRenderedOutput('default'); |
1398 | 1401 |
|
1399 | 1402 | act(() => setValue('new value')); |
1400 | 1403 | expect(Scheduler).toHaveYielded(['Suspend! [new value]', 'Loading...']); |
1401 | 1404 | jest.advanceTimersByTime(1000); |
1402 | 1405 |
|
1403 | 1406 | expect(Scheduler).toHaveYielded(['Promise resolved [new value]']); |
1404 | | - expect(Scheduler).toFlushExpired(['new value']); |
| 1407 | + expect(Scheduler).toFlushUntilNextPaint(['new value']); |
1405 | 1408 | expect(root).toMatchRenderedOutput('new value'); |
1406 | 1409 | }); |
1407 | 1410 |
|
@@ -1450,15 +1453,15 @@ describe('ReactSuspense', () => { |
1450 | 1453 | jest.advanceTimersByTime(1000); |
1451 | 1454 |
|
1452 | 1455 | expect(Scheduler).toHaveYielded(['Promise resolved [default]']); |
1453 | | - expect(Scheduler).toFlushExpired(['default']); |
| 1456 | + expect(Scheduler).toFlushUntilNextPaint(['default']); |
1454 | 1457 | expect(root).toMatchRenderedOutput('default'); |
1455 | 1458 |
|
1456 | 1459 | act(() => setValue('new value')); |
1457 | 1460 | expect(Scheduler).toHaveYielded(['Suspend! [new value]', 'Loading...']); |
1458 | 1461 | jest.advanceTimersByTime(1000); |
1459 | 1462 |
|
1460 | 1463 | expect(Scheduler).toHaveYielded(['Promise resolved [new value]']); |
1461 | | - expect(Scheduler).toFlushExpired(['new value']); |
| 1464 | + expect(Scheduler).toFlushUntilNextPaint(['new value']); |
1462 | 1465 | expect(root).toMatchRenderedOutput('new value'); |
1463 | 1466 | }); |
1464 | 1467 |
|
@@ -1506,15 +1509,15 @@ describe('ReactSuspense', () => { |
1506 | 1509 | jest.advanceTimersByTime(1000); |
1507 | 1510 |
|
1508 | 1511 | expect(Scheduler).toHaveYielded(['Promise resolved [default]']); |
1509 | | - expect(Scheduler).toFlushExpired(['default']); |
| 1512 | + expect(Scheduler).toFlushUntilNextPaint(['default']); |
1510 | 1513 | expect(root).toMatchRenderedOutput('default'); |
1511 | 1514 |
|
1512 | 1515 | act(() => setValue('new value')); |
1513 | 1516 | expect(Scheduler).toHaveYielded(['Suspend! [new value]', 'Loading...']); |
1514 | 1517 | jest.advanceTimersByTime(1000); |
1515 | 1518 |
|
1516 | 1519 | expect(Scheduler).toHaveYielded(['Promise resolved [new value]']); |
1517 | | - expect(Scheduler).toFlushExpired(['new value']); |
| 1520 | + expect(Scheduler).toFlushUntilNextPaint(['new value']); |
1518 | 1521 | expect(root).toMatchRenderedOutput('new value'); |
1519 | 1522 | }); |
1520 | 1523 |
|
@@ -1558,15 +1561,15 @@ describe('ReactSuspense', () => { |
1558 | 1561 | jest.advanceTimersByTime(1000); |
1559 | 1562 |
|
1560 | 1563 | expect(Scheduler).toHaveYielded(['Promise resolved [default]']); |
1561 | | - expect(Scheduler).toFlushExpired(['default']); |
| 1564 | + expect(Scheduler).toFlushUntilNextPaint(['default']); |
1562 | 1565 | expect(root).toMatchRenderedOutput('default'); |
1563 | 1566 |
|
1564 | 1567 | act(() => setValue('new value')); |
1565 | 1568 | expect(Scheduler).toHaveYielded(['Suspend! [new value]', 'Loading...']); |
1566 | 1569 | jest.advanceTimersByTime(1000); |
1567 | 1570 |
|
1568 | 1571 | expect(Scheduler).toHaveYielded(['Promise resolved [new value]']); |
1569 | | - expect(Scheduler).toFlushExpired(['new value']); |
| 1572 | + expect(Scheduler).toFlushUntilNextPaint(['new value']); |
1570 | 1573 | expect(root).toMatchRenderedOutput('new value'); |
1571 | 1574 | }); |
1572 | 1575 | }); |
|