@@ -306,101 +306,6 @@ describe('ReactDOMFiberAsync', () => {
306
306
expect ( container . textContent ) . toEqual ( 'ABCD' ) ;
307
307
} ) ;
308
308
309
- // @gate www
310
- it ( 'flushControlled flushes updates before yielding to browser' , async ( ) => {
311
- let inst ;
312
- class Counter extends React . Component {
313
- state = { counter : 0 } ;
314
- increment = ( ) =>
315
- this . setState ( state => ( { counter : state . counter + 1 } ) ) ;
316
- render ( ) {
317
- inst = this ;
318
- return this . state . counter ;
319
- }
320
- }
321
- const root = ReactDOMClient . createRoot ( container ) ;
322
- await act ( ( ) => root . render ( < Counter /> ) ) ;
323
- expect ( container . textContent ) . toEqual ( '0' ) ;
324
-
325
- // Test that a normal update is async
326
- await act ( ( ) => {
327
- inst . increment ( ) ;
328
- expect ( container . textContent ) . toEqual ( '0' ) ;
329
- } ) ;
330
- expect ( container . textContent ) . toEqual ( '1' ) ;
331
-
332
- const ops = [ ] ;
333
- ReactDOM . unstable_flushControlled ( ( ) => {
334
- inst . increment ( ) ;
335
- ReactDOM . unstable_flushControlled ( ( ) => {
336
- inst . increment ( ) ;
337
- ops . push ( 'end of inner flush: ' + container . textContent ) ;
338
- } ) ;
339
- ops . push ( 'end of outer flush: ' + container . textContent ) ;
340
- } ) ;
341
- ops . push ( 'after outer flush: ' + container . textContent ) ;
342
- expect ( ops ) . toEqual ( [
343
- 'end of inner flush: 1' ,
344
- 'end of outer flush: 1' ,
345
- 'after outer flush: 3' ,
346
- ] ) ;
347
- } ) ;
348
-
349
- // @gate www
350
- it ( 'flushControlled does not flush until end of outermost batchedUpdates' , ( ) => {
351
- let inst ;
352
- class Counter extends React . Component {
353
- state = { counter : 0 } ;
354
- increment = ( ) =>
355
- this . setState ( state => ( { counter : state . counter + 1 } ) ) ;
356
- render ( ) {
357
- inst = this ;
358
- return this . state . counter ;
359
- }
360
- }
361
- ReactDOM . render ( < Counter /> , container ) ;
362
-
363
- const ops = [ ] ;
364
- ReactDOM . unstable_batchedUpdates ( ( ) => {
365
- inst . increment ( ) ;
366
- ReactDOM . unstable_flushControlled ( ( ) => {
367
- inst . increment ( ) ;
368
- ops . push ( 'end of flushControlled fn: ' + container . textContent ) ;
369
- } ) ;
370
- ops . push ( 'end of batchedUpdates fn: ' + container . textContent ) ;
371
- } ) ;
372
- ops . push ( 'after batchedUpdates: ' + container . textContent ) ;
373
- expect ( ops ) . toEqual ( [
374
- 'end of flushControlled fn: 0' ,
375
- 'end of batchedUpdates fn: 0' ,
376
- 'after batchedUpdates: 2' ,
377
- ] ) ;
378
- } ) ;
379
-
380
- // @gate www
381
- it ( 'flushControlled returns nothing' , ( ) => {
382
- // In the future, we may want to return a thenable "work" object.
383
- let inst ;
384
- class Counter extends React . Component {
385
- state = { counter : 0 } ;
386
- increment = ( ) =>
387
- this . setState ( state => ( { counter : state . counter + 1 } ) ) ;
388
- render ( ) {
389
- inst = this ;
390
- return this . state . counter ;
391
- }
392
- }
393
- ReactDOM . render ( < Counter /> , container ) ;
394
- expect ( container . textContent ) . toEqual ( '0' ) ;
395
-
396
- const returnValue = ReactDOM . unstable_flushControlled ( ( ) => {
397
- inst . increment ( ) ;
398
- return 'something' ;
399
- } ) ;
400
- expect ( container . textContent ) . toEqual ( '1' ) ;
401
- expect ( returnValue ) . toBe ( undefined ) ;
402
- } ) ;
403
-
404
309
it ( 'ignores discrete events on a pending removed element' , async ( ) => {
405
310
const disableButtonRef = React . createRef ( ) ;
406
311
const submitButtonRef = React . createRef ( ) ;
0 commit comments