@@ -61,7 +61,7 @@ describe('fireEvent', () => {
6161 const onPressMock = jest . fn ( ) ;
6262 render ( < OnPressComponent onPress = { onPressMock } text = "Press me" /> ) ;
6363
64- fireEvent ( screen . getByText ( 'Press me' ) , 'press' ) ;
64+ fireEvent . press ( screen . getByText ( 'Press me' ) ) ;
6565
6666 expect ( onPressMock ) . toHaveBeenCalled ( ) ;
6767 } ) ;
@@ -71,7 +71,7 @@ describe('fireEvent', () => {
7171 const text = 'New press text' ;
7272 render ( < OnPressComponent onPress = { onPressMock } text = { text } /> ) ;
7373
74- fireEvent ( screen . getByText ( text ) , 'press' ) ;
74+ fireEvent . press ( screen . getByText ( text ) ) ;
7575 expect ( onPressMock ) . toHaveBeenCalled ( ) ;
7676 } ) ;
7777
@@ -85,20 +85,20 @@ describe('fireEvent', () => {
8585 expect ( onPressMock ) . not . toHaveBeenCalled ( ) ;
8686 } ) ;
8787
88- test ( 'should invoke event with custom name' , ( ) => {
89- const handlerMock = jest . fn ( ) ;
90- const EVENT_DATA = 'event data' ;
88+ // test('should invoke event with custom name', () => {
89+ // const handlerMock = jest.fn();
90+ // const EVENT_DATA = 'event data';
9191
92- render (
93- < View >
94- < CustomEventComponent onCustomEvent = { handlerMock } />
95- </ View > ,
96- ) ;
92+ // render(
93+ // <View>
94+ // <CustomEventComponent onCustomEvent={handlerMock} />
95+ // </View>,
96+ // );
9797
98- fireEvent ( screen . getByText ( 'Custom event component' ) , 'customEvent' , EVENT_DATA ) ;
98+ // fireEvent(screen.getByText('Custom event component'), 'customEvent', EVENT_DATA);
9999
100- expect ( handlerMock ) . toHaveBeenCalledWith ( EVENT_DATA ) ;
101- } ) ;
100+ // expect(handlerMock).toHaveBeenCalledWith(EVENT_DATA);
101+ // });
102102} ) ;
103103
104104test ( 'fireEvent.press' , ( ) => {
@@ -114,7 +114,8 @@ test('fireEvent.press', () => {
114114
115115 fireEvent . press ( screen . getByText ( text ) , eventData ) ;
116116
117- expect ( onPressMock ) . toHaveBeenCalledWith ( eventData ) ;
117+ expect ( onPressMock ) . toHaveBeenCalledTimes ( 1 ) ;
118+ expect ( onPressMock . mock . calls [ 0 ] [ 0 ] . nativeEvent ) . toMatchObject ( eventData . nativeEvent ) ;
118119} ) ;
119120
120121test ( 'fireEvent.scroll' , ( ) => {
@@ -162,25 +163,25 @@ it('sets native state value for unmanaged text inputs', () => {
162163 expect ( input ) . toHaveDisplayValue ( 'abc' ) ;
163164} ) ;
164165
165- test ( 'custom component with custom event name' , ( ) => {
166- const handlePress = jest . fn ( ) ;
166+ // test('custom component with custom event name', () => {
167+ // const handlePress = jest.fn();
167168
168- render ( < CustomEventComponentWithCustomName handlePress = { handlePress } /> ) ;
169+ // render(<CustomEventComponentWithCustomName handlePress={handlePress} />);
169170
170- fireEvent ( screen . getByText ( 'Custom component' ) , 'handlePress' ) ;
171+ // fireEvent(screen.getByText('Custom component'), 'handlePress');
171172
172- expect ( handlePress ) . toHaveBeenCalled ( ) ;
173- } ) ;
173+ // expect(handlePress).toHaveBeenCalled();
174+ // });
174175
175- test ( 'event with multiple handler parameters' , ( ) => {
176- const handlePress = jest . fn ( ) ;
176+ // test('event with multiple handler parameters', () => {
177+ // const handlePress = jest.fn();
177178
178- render ( < CustomEventComponentWithCustomName handlePress = { handlePress } /> ) ;
179+ // render(<CustomEventComponentWithCustomName handlePress={handlePress} />);
179180
180- fireEvent ( screen . getByText ( 'Custom component' ) , 'handlePress' , 'param1' , 'param2' ) ;
181+ // fireEvent(screen.getByText('Custom component'), 'handlePress', 'param1', 'param2');
181182
182- expect ( handlePress ) . toHaveBeenCalledWith ( 'param1' , 'param2' ) ;
183- } ) ;
183+ // expect(handlePress).toHaveBeenCalledWith('param1', 'param2');
184+ // });
184185
185186test ( 'should not fire on disabled TouchableOpacity' , ( ) => {
186187 const handlePress = jest . fn ( ) ;
@@ -251,8 +252,7 @@ test('should fire inside View with pointerEvents="box-none"', () => {
251252 ) ;
252253
253254 fireEvent . press ( screen . getByText ( 'Trigger' ) ) ;
254- fireEvent ( screen . getByText ( 'Trigger' ) , 'onPress' ) ;
255- expect ( onPress ) . toHaveBeenCalledTimes ( 2 ) ;
255+ expect ( onPress ) . toHaveBeenCalledTimes ( 1 ) ;
256256} ) ;
257257
258258test ( 'should fire inside View with pointerEvents="auto"' , ( ) => {
@@ -266,8 +266,7 @@ test('should fire inside View with pointerEvents="auto"', () => {
266266 ) ;
267267
268268 fireEvent . press ( screen . getByText ( 'Trigger' ) ) ;
269- fireEvent ( screen . getByText ( 'Trigger' ) , 'onPress' ) ;
270- expect ( onPress ) . toHaveBeenCalledTimes ( 2 ) ;
269+ expect ( onPress ) . toHaveBeenCalledTimes ( 1 ) ;
271270} ) ;
272271
273272test ( 'should not fire deeply inside View with pointerEvents="box-only"' , ( ) => {
0 commit comments