@@ -13,6 +13,8 @@ const React = require('react');
13
13
const ReactDOM = require ( 'react-dom' ) ;
14
14
const PropTypes = require ( 'prop-types' ) ;
15
15
16
+ const ReactFeatureFlags = require ( 'shared/ReactFeatureFlags' ) ;
17
+
16
18
describe ( 'ReactDOMFiber' , ( ) => {
17
19
let container ;
18
20
@@ -247,30 +249,32 @@ describe('ReactDOMFiber', () => {
247
249
} ) ;
248
250
249
251
// TODO: remove in React 17
250
- it ( 'should support unstable_createPortal alias' , ( ) => {
251
- const portalContainer = document . createElement ( 'div' ) ;
252
+ if ( ! ReactFeatureFlags . disableUnstableCreatePortal ) {
253
+ it ( 'should support unstable_createPortal alias' , ( ) => {
254
+ const portalContainer = document . createElement ( 'div' ) ;
252
255
253
- expect ( ( ) =>
254
- ReactDOM . render (
255
- < div >
256
- { ReactDOM . unstable_createPortal ( < div > portal</ div > , portalContainer ) }
257
- </ div > ,
258
- container ,
259
- ) ,
260
- ) . toWarnDev (
261
- 'The ReactDOM.unstable_createPortal() alias has been deprecated, ' +
262
- 'and will be removed in React 17+. Update your code to use ' +
263
- 'ReactDOM.createPortal() instead. It has the exact same API, ' +
264
- 'but without the "unstable_" prefix.' ,
265
- { withoutStack : true } ,
266
- ) ;
267
- expect ( portalContainer . innerHTML ) . toBe ( '<div>portal</div>' ) ;
268
- expect ( container . innerHTML ) . toBe ( '<div></div>' ) ;
256
+ expect ( ( ) =>
257
+ ReactDOM . render (
258
+ < div >
259
+ { ReactDOM . unstable_createPortal ( < div > portal</ div > , portalContainer ) }
260
+ </ div > ,
261
+ container ,
262
+ ) ,
263
+ ) . toWarnDev (
264
+ 'The ReactDOM.unstable_createPortal() alias has been deprecated, ' +
265
+ 'and will be removed in React 17+. Update your code to use ' +
266
+ 'ReactDOM.createPortal() instead. It has the exact same API, ' +
267
+ 'but without the "unstable_" prefix.' ,
268
+ { withoutStack : true } ,
269
+ ) ;
270
+ expect ( portalContainer . innerHTML ) . toBe ( '<div>portal</div>' ) ;
271
+ expect ( container . innerHTML ) . toBe ( '<div></div>' ) ;
269
272
270
- ReactDOM . unmountComponentAtNode ( container ) ;
271
- expect ( portalContainer . innerHTML ) . toBe ( '' ) ;
272
- expect ( container . innerHTML ) . toBe ( '' ) ;
273
- } ) ;
273
+ ReactDOM . unmountComponentAtNode ( container ) ;
274
+ expect ( portalContainer . innerHTML ) . toBe ( '' ) ;
275
+ expect ( container . innerHTML ) . toBe ( '' ) ;
276
+ } ) ;
277
+ }
274
278
275
279
it ( 'should render many portals' , ( ) => {
276
280
const portalContainer1 = document . createElement ( 'div' ) ;
0 commit comments