Skip to content

Commit 1eaf07e

Browse files
committed
refactor: more strict test conditions
1 parent 7d5f04a commit 1eaf07e

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/__tests__/fireEvent.test.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,11 @@ test('event with multiple handler parameters', () => {
168168
test('should not fire on disabled TouchableOpacity', () => {
169169
const handlePress = jest.fn();
170170
const screen = render(
171-
<TouchableOpacity onPress={handlePress} disabled={true}>
172-
<Text>Trigger</Text>
173-
</TouchableOpacity>
171+
<View>
172+
<TouchableOpacity onPress={handlePress} disabled={true}>
173+
<Text>Trigger</Text>
174+
</TouchableOpacity>
175+
</View>
174176
);
175177

176178
fireEvent.press(screen.getByText('Trigger'));
@@ -180,9 +182,11 @@ test('should not fire on disabled TouchableOpacity', () => {
180182
test('should not fire on disabled Pressable', () => {
181183
const handlePress = jest.fn();
182184
const screen = render(
183-
<Pressable onPress={handlePress} disabled={true}>
184-
<Text>Trigger</Text>
185-
</Pressable>
185+
<View>
186+
<Pressable onPress={handlePress} disabled={true}>
187+
<Text>Trigger</Text>
188+
</Pressable>
189+
</View>
186190
);
187191

188192
fireEvent.press(screen.getByText('Trigger'));

0 commit comments

Comments
 (0)