@@ -13,6 +13,8 @@ const React = require('react');
1313const ReactDOM = require ( 'react-dom' ) ;
1414const PropTypes = require ( 'prop-types' ) ;
1515
16+ const ReactFeatureFlags = require ( 'shared/ReactFeatureFlags' ) ;
17+
1618describe ( 'ReactDOMFiber' , ( ) => {
1719 let container ;
1820
@@ -247,30 +249,32 @@ describe('ReactDOMFiber', () => {
247249 } ) ;
248250
249251 // 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' ) ;
252255
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>' ) ;
269272
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+ }
274278
275279 it ( 'should render many portals' , ( ) => {
276280 const portalContainer1 = document . createElement ( 'div' ) ;
0 commit comments