@@ -2,7 +2,7 @@ import * as React from 'react';
22import { Text , View } from 'react-native' ;
33
44import { render , screen } from '..' ;
5- import { getEventHandler } from '../event-handler' ;
5+ import { getEventHandlerFromProps } from '../event-handler' ;
66
77test ( 'getEventHandler strict mode' , ( ) => {
88 const onPress = jest . fn ( ) ;
@@ -22,13 +22,13 @@ test('getEventHandler strict mode', () => {
2222 const testOnly = screen . getByTestId ( 'testOnly' ) ;
2323 const both = screen . getByTestId ( 'both' ) ;
2424
25- expect ( getEventHandler ( regular , 'press' ) ) . toBe ( onPress ) ;
26- expect ( getEventHandler ( testOnly , 'press' ) ) . toBe ( testOnlyOnPress ) ;
27- expect ( getEventHandler ( both , 'press' ) ) . toBe ( onPress ) ;
25+ expect ( getEventHandlerFromProps ( regular . props , 'press' ) ) . toBe ( onPress ) ;
26+ expect ( getEventHandlerFromProps ( testOnly . props , 'press' ) ) . toBe ( testOnlyOnPress ) ;
27+ expect ( getEventHandlerFromProps ( both . props , 'press' ) ) . toBe ( onPress ) ;
2828
29- expect ( getEventHandler ( regular , 'onPress' ) ) . toBe ( undefined ) ;
30- expect ( getEventHandler ( testOnly , 'onPress' ) ) . toBe ( undefined ) ;
31- expect ( getEventHandler ( both , 'onPress' ) ) . toBe ( undefined ) ;
29+ expect ( getEventHandlerFromProps ( regular . props , 'onPress' ) ) . toBe ( undefined ) ;
30+ expect ( getEventHandlerFromProps ( testOnly . props , 'onPress' ) ) . toBe ( undefined ) ;
31+ expect ( getEventHandlerFromProps ( both . props , 'onPress' ) ) . toBe ( undefined ) ;
3232} ) ;
3333
3434test ( 'getEventHandler loose mode' , ( ) => {
@@ -49,11 +49,13 @@ test('getEventHandler loose mode', () => {
4949 const testOnly = screen . getByTestId ( 'testOnly' ) ;
5050 const both = screen . getByTestId ( 'both' ) ;
5151
52- expect ( getEventHandler ( regular , 'press' , { loose : true } ) ) . toBe ( onPress ) ;
53- expect ( getEventHandler ( testOnly , 'press' , { loose : true } ) ) . toBe ( testOnlyOnPress ) ;
54- expect ( getEventHandler ( both , 'press' , { loose : true } ) ) . toBe ( onPress ) ;
52+ expect ( getEventHandlerFromProps ( regular . props , 'press' , { loose : true } ) ) . toBe ( onPress ) ;
53+ expect ( getEventHandlerFromProps ( testOnly . props , 'press' , { loose : true } ) ) . toBe ( testOnlyOnPress ) ;
54+ expect ( getEventHandlerFromProps ( both . props , 'press' , { loose : true } ) ) . toBe ( onPress ) ;
5555
56- expect ( getEventHandler ( regular , 'onPress' , { loose : true } ) ) . toBe ( onPress ) ;
57- expect ( getEventHandler ( testOnly , 'onPress' , { loose : true } ) ) . toBe ( testOnlyOnPress ) ;
58- expect ( getEventHandler ( both , 'onPress' , { loose : true } ) ) . toBe ( onPress ) ;
56+ expect ( getEventHandlerFromProps ( regular . props , 'onPress' , { loose : true } ) ) . toBe ( onPress ) ;
57+ expect ( getEventHandlerFromProps ( testOnly . props , 'onPress' , { loose : true } ) ) . toBe (
58+ testOnlyOnPress ,
59+ ) ;
60+ expect ( getEventHandlerFromProps ( both . props , 'onPress' , { loose : true } ) ) . toBe ( onPress ) ;
5961} ) ;
0 commit comments