@@ -86,34 +86,34 @@ test('calling a custom event works as well', () => {
8686 } ) ;
8787} ) ;
8888
89- test ( 'calling a handler when there is no valid target throws ' , ( ) => {
89+ test ( 'calling a handler when there is no valid target does not work ' , ( ) => {
9090 const handleEvent = jest . fn ( ) ;
9191 const { getByTestId } = render ( < Image onPress = { handleEvent } testID = "image" /> ) ;
92- expect ( ( ) => fireEvent . press ( getByTestId ( 'image' ) ) ) . toThrow ( ) ;
92+ expect ( ( ) => fireEvent . press ( getByTestId ( 'image' ) ) ) . not . toThrow ( ) ;
9393 expect ( handleEvent ) . toBeCalledTimes ( 0 ) ;
9494} ) ;
9595
96- test ( 'calling a handler if a Button is disabled throws ' , ( ) => {
96+ test ( 'calling a handler if a Button is disabled does not work ' , ( ) => {
9797 const handleEvent = jest . fn ( ) ;
9898 const { getByText } = render ( < Button disabled onPress = { handleEvent } title = "button" /> ) ;
99- expect ( ( ) => fireEvent . press ( getByText ( 'button' ) ) ) . toThrow ( ) ;
99+ expect ( ( ) => fireEvent . press ( getByText ( 'button' ) ) ) . not . toThrow ( ) ;
100100 expect ( handleEvent ) . toBeCalledTimes ( 0 ) ;
101101} ) ;
102102
103- test ( 'calling a handler if a Touchable is disabled throws ' , ( ) => {
103+ test ( 'calling a handler if a Touchable is disabled does not work ' , ( ) => {
104104 const handleEvent = jest . fn ( ) ;
105105 const { getByText } = render (
106106 < TouchableHighlight disabled onPress = { jest . fn ( ) } >
107107 < Text > touchable</ Text >
108108 </ TouchableHighlight > ,
109109 ) ;
110- expect ( ( ) => fireEvent . press ( getByText ( 'touchable' ) ) ) . toThrow ( ) ;
110+ expect ( ( ) => fireEvent . press ( getByText ( 'touchable' ) ) ) . not . toThrow ( ) ;
111111 expect ( handleEvent ) . toBeCalledTimes ( 0 ) ;
112112} ) ;
113113
114114test ( 'calling an event that has no defined handler throws' , ( ) => {
115115 const { getByText } = render ( < Text > test</ Text > ) ;
116- expect ( ( ) => fireEvent . press ( getByText ( 'test' ) ) ) . toThrow ( ) ;
116+ expect ( ( ) => fireEvent . press ( getByText ( 'test' ) ) ) . not . toThrow ( ) ;
117117} ) ;
118118
119119test ( 'calling an event sets nativeEvent properly' , ( ) => {
0 commit comments