@@ -26,17 +26,25 @@ describe('ReactComponent', () => {
26
26
act = require ( 'internal-test-utils' ) . act ;
27
27
} ) ;
28
28
29
- // @gate !disableLegacyMode
29
+ // @gate !disableLegacyMode && www
30
30
it ( 'should throw on invalid render targets in legacy roots' , ( ) => {
31
31
const container = document . createElement ( 'div' ) ;
32
32
// jQuery objects are basically arrays; people often pass them in by mistake
33
- expect ( function ( ) {
34
- ReactDOM . render ( < div /> , [ container ] ) ;
35
- } ) . toThrowError ( / T a r g e t c o n t a i n e r i s n o t a D O M e l e m e n t ./ ) ;
36
-
37
- expect ( function ( ) {
38
- ReactDOM . render ( < div /> , null ) ;
39
- } ) . toThrowError ( / T a r g e t c o n t a i n e r i s n o t a D O M e l e m e n t ./ ) ;
33
+ expect ( ( ) => {
34
+ expect ( function ( ) {
35
+ ReactDOM . render ( < div /> , [ container ] ) ;
36
+ } ) . toThrowError ( / T a r g e t c o n t a i n e r i s n o t a D O M e l e m e n t ./ ) ;
37
+
38
+ expect ( function ( ) {
39
+ ReactDOM . render ( < div /> , null ) ;
40
+ } ) . toThrowError ( / T a r g e t c o n t a i n e r i s n o t a D O M e l e m e n t ./ ) ;
41
+ } ) . toErrorDev (
42
+ [
43
+ 'ReactDOM.render is no longer supported in React 18.' ,
44
+ 'ReactDOM.render is no longer supported in React 18.' ,
45
+ ] ,
46
+ { withoutStack : true } ,
47
+ ) ;
40
48
} ) ;
41
49
42
50
// @gate !disableStringRefs
@@ -456,16 +464,25 @@ describe('ReactComponent', () => {
456
464
/* eslint-enable indent */
457
465
} ) ;
458
466
459
- // @gate !disableLegacyMode
467
+ // @gate !disableLegacyMode && www
460
468
it ( 'fires the callback after a component is rendered in legacy roots' , ( ) => {
461
469
const callback = jest . fn ( ) ;
462
470
const container = document . createElement ( 'div' ) ;
463
- ReactDOM . render ( < div /> , container , callback ) ;
464
- expect ( callback ) . toHaveBeenCalledTimes ( 1 ) ;
465
- ReactDOM . render ( < div className = "foo" /> , container , callback ) ;
466
- expect ( callback ) . toHaveBeenCalledTimes ( 2 ) ;
467
- ReactDOM . render ( < span /> , container , callback ) ;
468
- expect ( callback ) . toHaveBeenCalledTimes ( 3 ) ;
471
+ expect ( ( ) => {
472
+ ReactDOM . render ( < div /> , container , callback ) ;
473
+ expect ( callback ) . toHaveBeenCalledTimes ( 1 ) ;
474
+ ReactDOM . render ( < div className = "foo" /> , container , callback ) ;
475
+ expect ( callback ) . toHaveBeenCalledTimes ( 2 ) ;
476
+ ReactDOM . render ( < span /> , container , callback ) ;
477
+ expect ( callback ) . toHaveBeenCalledTimes ( 3 ) ;
478
+ } ) . toErrorDev (
479
+ [
480
+ 'ReactDOM.render is no longer supported in React 18.' ,
481
+ 'ReactDOM.render is no longer supported in React 18.' ,
482
+ 'ReactDOM.render is no longer supported in React 18.' ,
483
+ ] ,
484
+ { withoutStack : true } ,
485
+ ) ;
469
486
} ) ;
470
487
471
488
it ( 'throws usefully when rendering badly-typed elements' , async ( ) => {
0 commit comments