@@ -274,8 +274,22 @@ describe('ReactElementClone', () => {
274
274
275
275
const root = ReactDOMClient . createRoot ( document . createElement ( 'div' ) ) ;
276
276
await act ( ( ) => root . render ( < Grandparent /> ) ) ;
277
- expect ( component . childRef ) . toEqual ( { current : null } ) ;
278
- expect ( component . parentRef . current . xyzRef . current . tagName ) . toBe ( 'SPAN' ) ;
277
+ if ( gate ( flags => flags . enableRefAsProp && flags . disableStringRefs ) ) {
278
+ expect ( component . childRef ) . toEqual ( { current : null } ) ;
279
+ expect ( component . parentRef . current . xyzRef . current . tagName ) . toBe ( 'SPAN' ) ;
280
+ } else if (
281
+ gate ( flags => ! flags . enableRefAsProp && ! flags . disableStringRefs )
282
+ ) {
283
+ expect ( component . childRef ) . toEqual ( { current : null } ) ;
284
+ expect ( component . parentRef . current . xyzRef . current . tagName ) . toBe ( 'SPAN' ) ;
285
+ } else if (
286
+ gate ( flags => flags . enableRefAsProp && ! flags . disableStringRefs )
287
+ ) {
288
+ expect ( component . childRef ) . toEqual ( { current : null } ) ;
289
+ expect ( component . parentRef . current . xyzRef . current . tagName ) . toBe ( 'SPAN' ) ;
290
+ } else {
291
+ // Not going to bother testing every possible combination.
292
+ }
279
293
} ) ;
280
294
281
295
it ( 'should overwrite props' , async ( ) => {
@@ -371,6 +385,11 @@ describe('ReactElementClone', () => {
371
385
) {
372
386
expect ( clone . ref ) . toBe ( element . ref ) ;
373
387
expect ( clone . props ) . toEqual ( { foo : 'ef' } ) ;
388
+ } else if (
389
+ gate ( flags => flags . enableRefAsProp && ! flags . disableStringRefs )
390
+ ) {
391
+ expect ( clone . ref ) . toBe ( element . ref ) ;
392
+ expect ( clone . props ) . toEqual ( { foo : 'ef' } ) ;
374
393
} else {
375
394
// Not going to bother testing every possible combination.
376
395
}
0 commit comments