@@ -86,6 +86,9 @@ describe('ReactDOMServerIntegration', () => {
86
86
} ) ;
87
87
88
88
itRenders ( 'stateless child with context' , async render => {
89
+ if ( gate ( flags => flags . disableLegacyContextForFunctionComponents ) ) {
90
+ return ;
91
+ }
89
92
function FunctionChildWithContext ( props , context ) {
90
93
return < div > { context . text } </ div > ;
91
94
}
@@ -118,6 +121,9 @@ describe('ReactDOMServerIntegration', () => {
118
121
} ) ;
119
122
120
123
itRenders ( 'stateless child without context' , async render => {
124
+ if ( gate ( flags => flags . disableLegacyContextForFunctionComponents ) ) {
125
+ return ;
126
+ }
121
127
function FunctionChildWithoutContext ( props , context ) {
122
128
// this should render blank; context isn't passed to this component.
123
129
return < div > { context . text } </ div > ;
@@ -151,6 +157,9 @@ describe('ReactDOMServerIntegration', () => {
151
157
} ) ;
152
158
153
159
itRenders ( 'stateless child with wrong context' , async render => {
160
+ if ( gate ( flags => flags . disableLegacyContextForFunctionComponents ) ) {
161
+ return ;
162
+ }
154
163
function FunctionChildWithWrongContext ( props , context ) {
155
164
// this should render blank; context.text isn't passed to this component.
156
165
return < div id = "statelessWrongChild" > { context . text } </ div > ;
@@ -169,6 +178,9 @@ describe('ReactDOMServerIntegration', () => {
169
178
} ) ;
170
179
171
180
itRenders ( 'with context passed through to a grandchild' , async render => {
181
+ if ( gate ( flags => flags . disableLegacyContextForFunctionComponents ) ) {
182
+ return ;
183
+ }
172
184
function Grandchild ( props , context ) {
173
185
return < div > { context . text } </ div > ;
174
186
}
@@ -186,6 +198,9 @@ describe('ReactDOMServerIntegration', () => {
186
198
} ) ;
187
199
188
200
itRenders ( 'a child context overriding a parent context' , async render => {
201
+ if ( gate ( flags => flags . disableLegacyContextForFunctionComponents ) ) {
202
+ return ;
203
+ }
189
204
const Grandchild = ( props , context ) => {
190
205
return < div > { context . text } </ div > ;
191
206
} ;
@@ -203,6 +218,9 @@ describe('ReactDOMServerIntegration', () => {
203
218
} ) ;
204
219
205
220
itRenders ( 'a child context merged with a parent context' , async render => {
221
+ if ( gate ( flags => flags . disableLegacyContextForFunctionComponents ) ) {
222
+ return ;
223
+ }
206
224
class Parent extends React . Component {
207
225
getChildContext ( ) {
208
226
return { text1 : 'purple' } ;
@@ -244,6 +262,9 @@ describe('ReactDOMServerIntegration', () => {
244
262
itRenders (
245
263
'with a call to componentWillMount before getChildContext' ,
246
264
async render => {
265
+ if ( gate ( flags => flags . disableLegacyContextForFunctionComponents ) ) {
266
+ return ;
267
+ }
247
268
class WillMountContext extends React . Component {
248
269
getChildContext ( ) {
249
270
return { text : this . state . text } ;
@@ -270,6 +291,9 @@ describe('ReactDOMServerIntegration', () => {
270
291
itRenders (
271
292
'if getChildContext exists but childContextTypes is missing with a warning' ,
272
293
async render => {
294
+ if ( gate ( flags => flags . disableLegacyContextForFunctionComponents ) ) {
295
+ return ;
296
+ }
273
297
function HopefulChild ( props , context ) {
274
298
return context . foo || 'nope' ;
275
299
}
0 commit comments