@@ -16,7 +16,7 @@ let ReactNative;
1616let UIManager ;
1717let createReactNativeComponentClass ;
1818
19- describe ( 'created with ReactFabric called with ReactNative ' , ( ) => {
19+ describe ( 'ReactFabric' , ( ) => {
2020 beforeEach ( ( ) => {
2121 jest . resetModules ( ) ;
2222 require ( 'react-native/Libraries/ReactPrivate/InitializeNativeFabricUIManager' ) ;
@@ -75,86 +75,6 @@ describe('created with ReactFabric called with ReactNative', () => {
7575 } ) ;
7676
7777 it ( 'dispatches commands on Fabric nodes with the RN renderer' , ( ) => {
78- nativeFabricUIManager . dispatchCommand . mockClear ( ) ;
79- const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
80- validAttributes : { title : true } ,
81- uiViewClassName : 'RCTView' ,
82- } ) ) ;
83-
84- let ref = React . createRef ( ) ;
85-
86- ReactFabric . render ( < View title = "bar" ref = { ref } /> , 11 ) ;
87- expect ( nativeFabricUIManager . dispatchCommand ) . not . toBeCalled ( ) ;
88- ReactNative . dispatchCommand ( ref . current , 'myCommand' , [ 10 , 20 ] ) ;
89- expect ( nativeFabricUIManager . dispatchCommand ) . toHaveBeenCalledTimes ( 1 ) ;
90- expect ( nativeFabricUIManager . dispatchCommand ) . toHaveBeenCalledWith (
91- expect . any ( Object ) ,
92- 'myCommand' ,
93- [ 10 , 20 ] ,
94- ) ;
95- expect ( UIManager . dispatchViewManagerCommand ) . not . toBeCalled ( ) ;
96- } ) ;
97- } ) ;
98-
99- describe ( 'created with ReactNative called with ReactFabric' , ( ) => {
100- beforeEach ( ( ) => {
101- jest . resetModules ( ) ;
102- require ( 'react-native/Libraries/ReactPrivate/InitializeNativeFabricUIManager' ) ;
103- ReactFabric = require ( 'react-native-renderer/fabric' ) ;
104- jest . resetModules ( ) ;
105- UIManager = require ( 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface' )
106- . UIManager ;
107- jest . mock ( 'shared/ReactFeatureFlags' , ( ) =>
108- require ( 'shared/forks/ReactFeatureFlags.native-oss' ) ,
109- ) ;
110- ReactNative = require ( 'react-native-renderer' ) ;
111-
112- React = require ( 'react' ) ;
113- createReactNativeComponentClass = require ( 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface' )
114- . ReactNativeViewConfigRegistry . register ;
115- } ) ;
116-
117- it ( 'find Paper instances with the Fabric renderer' , ( ) => {
118- const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
119- validAttributes : { title : true } ,
120- uiViewClassName : 'RCTView' ,
121- } ) ) ;
122-
123- let ref = React . createRef ( ) ;
124-
125- class Component extends React . Component {
126- render ( ) {
127- return < View title = "foo" /> ;
128- }
129- }
130-
131- ReactNative . render ( < Component ref = { ref } /> , 11 ) ;
132-
133- let instance = ReactFabric . findHostInstance_DEPRECATED ( ref . current ) ;
134- expect ( instance . _nativeTag ) . toBe ( 3 ) ;
135- } ) ;
136-
137- it ( 'find Paper nodes with the Fabric renderer' , ( ) => {
138- const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
139- validAttributes : { title : true } ,
140- uiViewClassName : 'RCTView' ,
141- } ) ) ;
142-
143- let ref = React . createRef ( ) ;
144-
145- class Component extends React . Component {
146- render ( ) {
147- return < View title = "foo" /> ;
148- }
149- }
150-
151- ReactNative . render ( < Component ref = { ref } /> , 11 ) ;
152-
153- let handle = ReactFabric . findNodeHandle ( ref . current ) ;
154- expect ( handle ) . toBe ( 3 ) ;
155- } ) ;
156-
157- it ( 'dispatches commands on Paper nodes with the Fabric renderer' , ( ) => {
15878 UIManager . dispatchViewManagerCommand . mockReset ( ) ;
15979 const View = createReactNativeComponentClass ( 'RCTView' , ( ) => ( {
16080 validAttributes : { title : true } ,
@@ -163,16 +83,14 @@ describe('created with ReactNative called with ReactFabric', () => {
16383
16484 let ref = React . createRef ( ) ;
16585
166- ReactNative . render ( < View title = "bar" ref = { ref } /> , 11 ) ;
86+ ReactFabric . render ( < View title = "bar" ref = { ref } /> , 11 ) ;
16787 expect ( UIManager . dispatchViewManagerCommand ) . not . toBeCalled ( ) ;
168- ReactFabric . dispatchCommand ( ref . current , 'myCommand' , [ 10 , 20 ] ) ;
88+ ReactNative . dispatchCommand ( ref . current , 'myCommand' , [ 10 , 20 ] ) ;
16989 expect ( UIManager . dispatchViewManagerCommand ) . toHaveBeenCalledTimes ( 1 ) ;
17090 expect ( UIManager . dispatchViewManagerCommand ) . toHaveBeenCalledWith (
17191 expect . any ( Number ) ,
17292 'myCommand' ,
17393 [ 10 , 20 ] ,
17494 ) ;
175-
176- expect ( nativeFabricUIManager . dispatchCommand ) . not . toBeCalled ( ) ;
17795 } ) ;
17896} ) ;
0 commit comments