@@ -30,35 +30,6 @@ const WithoutEventComponent = (_props: WithoutEventComponentProps) => (
30
30
</ View >
31
31
) ;
32
32
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
-
62
33
describe ( 'fireEvent' , ( ) => {
63
34
test ( 'should invoke specified event' , ( ) => {
64
35
const onPressMock = jest . fn ( ) ;
@@ -87,21 +58,6 @@ describe('fireEvent', () => {
87
58
fireEvent ( screen . getByText ( 'Without event' ) , 'press' ) ;
88
59
expect ( onPressMock ) . not . toHaveBeenCalled ( ) ;
89
60
} ) ;
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
- // });
105
61
} ) ;
106
62
107
63
test ( 'fireEvent.press' , ( ) => {
@@ -166,26 +122,6 @@ it('sets native state value for unmanaged text inputs', () => {
166
122
expect ( input ) . toHaveDisplayValue ( 'abc' ) ;
167
123
} ) ;
168
124
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
-
189
125
test ( 'should not fire on disabled TouchableOpacity' , ( ) => {
190
126
const handlePress = jest . fn ( ) ;
191
127
render (
0 commit comments