@@ -30,35 +30,6 @@ const WithoutEventComponent = (_props: WithoutEventComponentProps) => (
3030 </ View >
3131) ;
3232
33- // type CustomEventComponentProps = {
34- // onCustomEvent: () => void;
35- // };
36-
37- // const CustomEventComponent = ({ onCustomEvent }: CustomEventComponentProps) => (
38- // <TouchableOpacity onPress={onCustomEvent}>
39- // <Text>Custom event component</Text>
40- // </TouchableOpacity>
41- // );
42-
43- // type MyCustomButtonProps = {
44- // handlePress: () => void;
45- // text: string;
46- // };
47-
48- // const MyCustomButton = ({ handlePress, text }: MyCustomButtonProps) => (
49- // <OnPressComponent onPress={handlePress} text={text} />
50- // );
51-
52- // type CustomEventComponentWithCustomNameProps = {
53- // handlePress: () => void;
54- // };
55-
56- // const CustomEventComponentWithCustomName = ({
57- // handlePress,
58- // }: CustomEventComponentWithCustomNameProps) => (
59- // <MyCustomButton handlePress={handlePress} text="Custom component" />
60- // );
61-
6233describe ( 'fireEvent' , ( ) => {
6334 test ( 'should invoke specified event' , ( ) => {
6435 const onPressMock = jest . fn ( ) ;
@@ -87,21 +58,6 @@ describe('fireEvent', () => {
8758 fireEvent ( screen . getByText ( 'Without event' ) , 'press' ) ;
8859 expect ( onPressMock ) . not . toHaveBeenCalled ( ) ;
8960 } ) ;
90-
91- // test('should invoke event with custom name', () => {
92- // const handlerMock = jest.fn();
93- // const EVENT_DATA = 'event data';
94-
95- // render(
96- // <View>
97- // <CustomEventComponent onCustomEvent={handlerMock} />
98- // </View>,
99- // );
100-
101- // fireEvent(screen.getByText('Custom event component'), 'customEvent', EVENT_DATA);
102-
103- // expect(handlerMock).toHaveBeenCalledWith(EVENT_DATA);
104- // });
10561} ) ;
10662
10763test ( 'fireEvent.press' , ( ) => {
@@ -166,26 +122,6 @@ it('sets native state value for unmanaged text inputs', () => {
166122 expect ( input ) . toHaveDisplayValue ( 'abc' ) ;
167123} ) ;
168124
169- // test('custom component with custom event name', () => {
170- // const handlePress = jest.fn();
171-
172- // render(<CustomEventComponentWithCustomName handlePress={handlePress} />);
173-
174- // fireEvent(screen.getByText('Custom component'), 'handlePress');
175-
176- // expect(handlePress).toHaveBeenCalled();
177- // });
178-
179- // test('event with multiple handler parameters', () => {
180- // const handlePress = jest.fn();
181-
182- // render(<CustomEventComponentWithCustomName handlePress={handlePress} />);
183-
184- // fireEvent(screen.getByText('Custom component'), 'handlePress', 'param1', 'param2');
185-
186- // expect(handlePress).toHaveBeenCalledWith('param1', 'param2');
187- // });
188-
189125test ( 'should not fire on disabled TouchableOpacity' , ( ) => {
190126 const handlePress = jest . fn ( ) ;
191127 render (
0 commit comments