@@ -45,6 +45,7 @@ describe('ReactNative', () => {
4545 require ( 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface' ) . TextInputState ;
4646 } ) ;
4747
48+ // @gate !disableLegacyMode
4849 it ( 'should be able to create and render a native component' , ( ) => {
4950 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
5051 validAttributes : { foo : true } ,
@@ -58,6 +59,7 @@ describe('ReactNative', () => {
5859 expect ( UIManager . updateView ) . not . toBeCalled ( ) ;
5960 } ) ;
6061
62+ // @gate !disableLegacyMode
6163 it ( 'should be able to create and update a native component' , ( ) => {
6264 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
6365 validAttributes : { foo : true } ,
@@ -79,6 +81,7 @@ describe('ReactNative', () => {
7981 expect ( UIManager . updateView ) . toBeCalledWith ( 3 , 'RCTView' , { foo : 'bar' } ) ;
8082 } ) ;
8183
84+ // @gate !disableLegacyMode
8285 it ( 'should not call UIManager.updateView after render for properties that have not changed' , ( ) => {
8386 const Text = createReactNativeComponentClass ( 'RCTText' , ( ) => ( {
8487 validAttributes : { foo : true } ,
@@ -105,6 +108,7 @@ describe('ReactNative', () => {
105108 expect ( UIManager . updateView ) . toHaveBeenCalledTimes ( 4 ) ;
106109 } ) ;
107110
111+ // @gate !disableLegacyMode
108112 it ( 'should call dispatchCommand for native refs' , ( ) => {
109113 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
110114 validAttributes : { foo : true } ,
@@ -133,6 +137,7 @@ describe('ReactNative', () => {
133137 ) ;
134138 } ) ;
135139
140+ // @gate !disableLegacyMode
136141 it ( 'should warn and no-op if calling dispatchCommand on non native refs' , ( ) => {
137142 class BasicClass extends React . Component {
138143 render ( ) {
@@ -162,6 +167,7 @@ describe('ReactNative', () => {
162167 expect ( UIManager . dispatchViewManagerCommand ) . not . toBeCalled ( ) ;
163168 } ) ;
164169
170+ // @gate !disableLegacyMode
165171 it ( 'should call sendAccessibilityEvent for native refs' , ( ) => {
166172 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
167173 validAttributes : { foo : true } ,
@@ -192,6 +198,7 @@ describe('ReactNative', () => {
192198 ) . toHaveBeenCalledWith ( expect . any ( Number ) , 'focus' ) ;
193199 } ) ;
194200
201+ // @gate !disableLegacyMode
195202 it ( 'should warn and no-op if calling sendAccessibilityEvent on non native refs' , ( ) => {
196203 class BasicClass extends React . Component {
197204 render ( ) {
@@ -221,6 +228,7 @@ describe('ReactNative', () => {
221228 expect ( UIManager . sendAccessibilityEvent ) . not . toBeCalled ( ) ;
222229 } ) ;
223230
231+ // @gate !disableLegacyMode
224232 it ( 'should not call UIManager.updateView from ref.setNativeProps for properties that have not changed' , ( ) => {
225233 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
226234 validAttributes : { foo : true } ,
@@ -254,6 +262,7 @@ describe('ReactNative', () => {
254262 ) ;
255263 } ) ;
256264
265+ // @gate !disableLegacyMode
257266 it ( 'should call UIManager.measure on ref.measure' , ( ) => {
258267 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
259268 validAttributes : { foo : true } ,
@@ -280,6 +289,7 @@ describe('ReactNative', () => {
280289 expect ( successCallback ) . toHaveBeenCalledWith ( 10 , 10 , 100 , 100 , 0 , 0 ) ;
281290 } ) ;
282291
292+ // @gate !disableLegacyMode
283293 it ( 'should call UIManager.measureInWindow on ref.measureInWindow' , ( ) => {
284294 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
285295 validAttributes : { foo : true } ,
@@ -306,6 +316,7 @@ describe('ReactNative', () => {
306316 expect ( successCallback ) . toHaveBeenCalledWith ( 10 , 10 , 100 , 100 ) ;
307317 } ) ;
308318
319+ // @gate !disableLegacyMode
309320 it ( 'should support reactTag in ref.measureLayout' , ( ) => {
310321 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
311322 validAttributes : { foo : true } ,
@@ -346,6 +357,7 @@ describe('ReactNative', () => {
346357 expect ( successCallback ) . toHaveBeenCalledWith ( 1 , 1 , 100 , 100 ) ;
347358 } ) ;
348359
360+ // @gate !disableLegacyMode
349361 it ( 'should support ref in ref.measureLayout of host components' , ( ) => {
350362 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
351363 validAttributes : { foo : true } ,
@@ -382,6 +394,7 @@ describe('ReactNative', () => {
382394 expect ( successCallback ) . toHaveBeenCalledWith ( 1 , 1 , 100 , 100 ) ;
383395 } ) ;
384396
397+ // @gate !disableLegacyMode
385398 it ( 'returns the correct instance and calls it in the callback' , ( ) => {
386399 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
387400 validAttributes : { foo : true } ,
@@ -403,6 +416,7 @@ describe('ReactNative', () => {
403416 expect ( a ) . toBe ( c ) ;
404417 } ) ;
405418
419+ // @gate !disableLegacyMode
406420 it ( 'renders and reorders children' , ( ) => {
407421 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
408422 validAttributes : { title : true } ,
@@ -427,12 +441,59 @@ describe('ReactNative', () => {
427441 const after = 'mxhpgwfralkeoivcstzy' ;
428442
429443 ReactNative . render ( < Component chars = { before } /> , 11 ) ;
430- expect ( UIManager . __dumpHierarchyForJestTestsOnly ( ) ) . toMatchSnapshot ( ) ;
444+ expect ( UIManager . __dumpHierarchyForJestTestsOnly ( ) ) . toMatchInlineSnapshot ( `
445+ "<native root> {}
446+ RCTView null
447+ RCTView {"title":"a"}
448+ RCTView {"title":"b"}
449+ RCTView {"title":"c"}
450+ RCTView {"title":"d"}
451+ RCTView {"title":"e"}
452+ RCTView {"title":"f"}
453+ RCTView {"title":"g"}
454+ RCTView {"title":"h"}
455+ RCTView {"title":"i"}
456+ RCTView {"title":"j"}
457+ RCTView {"title":"k"}
458+ RCTView {"title":"l"}
459+ RCTView {"title":"m"}
460+ RCTView {"title":"n"}
461+ RCTView {"title":"o"}
462+ RCTView {"title":"p"}
463+ RCTView {"title":"q"}
464+ RCTView {"title":"r"}
465+ RCTView {"title":"s"}
466+ RCTView {"title":"t"}"
467+ ` ) ;
431468
432469 ReactNative . render ( < Component chars = { after } /> , 11 ) ;
433- expect ( UIManager . __dumpHierarchyForJestTestsOnly ( ) ) . toMatchSnapshot ( ) ;
470+ expect ( UIManager . __dumpHierarchyForJestTestsOnly ( ) ) . toMatchInlineSnapshot ( `
471+ "<native root> {}
472+ RCTView null
473+ RCTView {"title":"m"}
474+ RCTView {"title":"x"}
475+ RCTView {"title":"h"}
476+ RCTView {"title":"p"}
477+ RCTView {"title":"g"}
478+ RCTView {"title":"w"}
479+ RCTView {"title":"f"}
480+ RCTView {"title":"r"}
481+ RCTView {"title":"a"}
482+ RCTView {"title":"l"}
483+ RCTView {"title":"k"}
484+ RCTView {"title":"e"}
485+ RCTView {"title":"o"}
486+ RCTView {"title":"i"}
487+ RCTView {"title":"v"}
488+ RCTView {"title":"c"}
489+ RCTView {"title":"s"}
490+ RCTView {"title":"t"}
491+ RCTView {"title":"z"}
492+ RCTView {"title":"y"}"
493+ ` ) ;
434494 } ) ;
435495
496+ // @gate !disableLegacyMode
436497 it ( 'calls setState with no arguments' , ( ) => {
437498 let mockArgs ;
438499 class Component extends React . Component {
@@ -448,6 +509,7 @@ describe('ReactNative', () => {
448509 expect ( mockArgs . length ) . toEqual ( 0 ) ;
449510 } ) ;
450511
512+ // @gate !disableLegacyMode
451513 it ( 'should not throw when <View> is used inside of a <Text> ancestor' , ( ) => {
452514 const Image = createReactNativeComponentClass ( 'RCTImage' , ( ) => ( {
453515 validAttributes : { } ,
@@ -478,6 +540,7 @@ describe('ReactNative', () => {
478540 ) ;
479541 } ) ;
480542
543+ // @gate !disableLegacyMode
481544 it ( 'should throw for text not inside of a <Text> ancestor' , async ( ) => {
482545 const ScrollView = createReactNativeComponentClass ( 'RCTScrollView' , ( ) => ( {
483546 validAttributes : { } ,
@@ -512,6 +575,7 @@ describe('ReactNative', () => {
512575 ) ;
513576 } ) ;
514577
578+ // @gate !disableLegacyMode
515579 it ( 'should not throw for text inside of an indirect <Text> ancestor' , ( ) => {
516580 const Text = createReactNativeComponentClass ( 'RCTText' , ( ) => ( {
517581 validAttributes : { } ,
@@ -528,6 +592,7 @@ describe('ReactNative', () => {
528592 ) ;
529593 } ) ;
530594
595+ // @gate !disableLegacyMode
531596 it ( 'findHostInstance_DEPRECATED should warn if used to find a host component inside StrictMode' , ( ) => {
532597 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
533598 validAttributes : { foo : true } ,
@@ -564,6 +629,7 @@ describe('ReactNative', () => {
564629 expect ( match ) . toBe ( child ) ;
565630 } ) ;
566631
632+ // @gate !disableLegacyMode
567633 it ( 'findHostInstance_DEPRECATED should warn if passed a component that is inside StrictMode' , ( ) => {
568634 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
569635 validAttributes : { foo : true } ,
@@ -601,6 +667,7 @@ describe('ReactNative', () => {
601667 expect ( match ) . toBe ( child ) ;
602668 } ) ;
603669
670+ // @gate !disableLegacyMode
604671 it ( 'findNodeHandle should warn if used to find a host component inside StrictMode' , ( ) => {
605672 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
606673 validAttributes : { foo : true } ,
@@ -635,6 +702,7 @@ describe('ReactNative', () => {
635702 expect ( match ) . toBe ( child . _nativeTag ) ;
636703 } ) ;
637704
705+ // @gate !disableLegacyMode
638706 it ( 'findNodeHandle should warn if passed a component that is inside StrictMode' , ( ) => {
639707 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
640708 validAttributes : { foo : true } ,
@@ -670,6 +738,7 @@ describe('ReactNative', () => {
670738 expect ( match ) . toBe ( child . _nativeTag ) ;
671739 } ) ;
672740
741+ // @gate !disableLegacyMode
673742 it ( 'blur on host component calls TextInputState' , ( ) => {
674743 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
675744 validAttributes : { foo : true } ,
@@ -687,6 +756,7 @@ describe('ReactNative', () => {
687756 expect ( TextInputState . blurTextInput ) . toHaveBeenCalledWith ( viewRef . current ) ;
688757 } ) ;
689758
759+ // @gate !disableLegacyMode
690760 it ( 'focus on host component calls TextInputState' , ( ) => {
691761 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
692762 validAttributes : { foo : true } ,
0 commit comments