Skip to content

Commit 390de3f

Browse files
author
Andrzej Antoni Kwaśniewski
committed
styling
1 parent 40eed71 commit 390de3f

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

packages/react-native-gesture-handler/src/__tests__/Errors.test.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ describe('VirtualDetector', () => {
2727
</GestureHandlerRootView>
2828
);
2929
}
30+
3031
expect(() => render(<VirtualDetectorWithNoBoundary />)).toThrow(
3132
'VirtualGestureDetector must be a descendant of an InterceptingGestureDetector'
3233
);
@@ -46,14 +47,17 @@ describe('VirtualDetector', () => {
4647
</GestureHandlerRootView>
4748
);
4849
}
50+
4951
expect(() => render(<VirtualDetectorAnimated />)).toThrow(
5052
'VirtualGestureDetector cannot handle Animated events with native driver when used inside InterceptingGestureDetector. Use Reanimated or Animated events without native driver instead.'
5153
);
5254
});
55+
5356
test('intercepting detector cant handle multiple types of events', () => {
5457
(findNodeHandle as jest.Mock).mockReturnValue(123);
5558
const mockWorklet = () => undefined;
5659
mockWorklet.__workletHash = 123;
60+
5761
function InterceptingDetectorMultipleTypes() {
5862
const tap = useTapGesture({ useAnimated: true });
5963
const tap2 = useTapGesture({ onActivate: mockWorklet });
@@ -67,6 +71,7 @@ describe('VirtualDetector', () => {
6771
</GestureHandlerRootView>
6872
);
6973
}
74+
7075
expect(() => render(<InterceptingDetectorMultipleTypes />)).toThrow(
7176
'InterceptingGestureDetector can only handle either Reanimated or Animated events.'
7277
);
@@ -87,6 +92,7 @@ describe('Check if descendant of root view', () => {
8792
'GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/installation for more details.'
8893
);
8994
});
95+
9096
test('intercepting detector', () => {
9197
function GestureDetectorNoRootView() {
9298
const tap = useTapGesture({});
@@ -96,10 +102,12 @@ describe('Check if descendant of root view', () => {
96102
</InterceptingGestureDetector>
97103
);
98104
}
105+
99106
expect(() => render(<GestureDetectorNoRootView />)).toThrow(
100107
'GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/installation for more details.'
101108
);
102109
});
110+
103111
test('legacy detector', () => {
104112
function GestureDetectorNoRootView() {
105113
const tap = Gesture.Tap();
@@ -109,6 +117,7 @@ describe('Check if descendant of root view', () => {
109117
</GestureDetector>
110118
);
111119
}
120+
112121
expect(() => render(<GestureDetectorNoRootView />)).toThrow(
113122
'GestureDetector must be used as a descendant of GestureHandlerRootView. Otherwise the gestures will not be recognized. See https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/installation for more details.'
114123
);

0 commit comments

Comments
 (0)