Skip to content

Commit 4261a32

Browse files
committed
disable accessibilityStates tests; fixups
1 parent 8d1df27 commit 4261a32

File tree

4 files changed

+48
-63
lines changed

4 files changed

+48
-63
lines changed

src/__tests__/__snapshots__/debug.test.js.snap

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`debug 1`] = `
4-
"<TouchableOpacity
5-
activeOpacity={0.2}
4+
"<ForwardRef
65
onPress={[Function _callee]}
76
>
87
<TextComponent
98
text=\\"Press me 0\\"
109
/>
11-
</TouchableOpacity>"
10+
</ForwardRef>"
1211
`;
1312

1413
exports[`debug.deep 1`] = `
1514
"<View
1615
accessible={true}
1716
focusable={true}
18-
isTVSelectable={true}
19-
onClick={[Function bound touchableHandlePress]}
20-
onResponderGrant={[Function bound touchableHandleResponderGrant]}
21-
onResponderMove={[Function bound touchableHandleResponderMove]}
22-
onResponderRelease={[Function bound touchableHandleResponderRelease]}
23-
onResponderTerminate={[Function bound touchableHandleResponderTerminate]}
24-
onResponderTerminationRequest={[Function bound touchableHandleResponderTerminationRequest]}
25-
onStartShouldSetResponder={[Function bound touchableHandleStartShouldSetResponder]}
17+
onClick={[Function onClick]}
18+
onResponderGrant={[Function onResponderGrant]}
19+
onResponderMove={[Function onResponderMove]}
20+
onResponderRelease={[Function onResponderRelease]}
21+
onResponderTerminate={[Function onResponderTerminate]}
22+
onResponderTerminationRequest={[Function onResponderTerminationRequest]}
23+
onStartShouldSetResponder={[Function onStartShouldSetResponder]}
2624
style={
2725
Object {
2826
\\"opacity\\": 1,
@@ -39,14 +37,13 @@ exports[`debug.deep async test 1`] = `
3937
"<View
4038
accessible={true}
4139
focusable={true}
42-
isTVSelectable={true}
43-
onClick={[Function bound touchableHandlePress]}
44-
onResponderGrant={[Function bound touchableHandleResponderGrant]}
45-
onResponderMove={[Function bound touchableHandleResponderMove]}
46-
onResponderRelease={[Function bound touchableHandleResponderRelease]}
47-
onResponderTerminate={[Function bound touchableHandleResponderTerminate]}
48-
onResponderTerminationRequest={[Function bound touchableHandleResponderTerminationRequest]}
49-
onStartShouldSetResponder={[Function bound touchableHandleStartShouldSetResponder]}
40+
onClick={[Function onClick]}
41+
onResponderGrant={[Function onResponderGrant]}
42+
onResponderMove={[Function onResponderMove]}
43+
onResponderRelease={[Function onResponderRelease]}
44+
onResponderTerminate={[Function onResponderTerminate]}
45+
onResponderTerminationRequest={[Function onResponderTerminationRequest]}
46+
onStartShouldSetResponder={[Function onStartShouldSetResponder]}
5047
style={
5148
Object {
5249
\\"opacity\\": 1,

src/__tests__/__snapshots__/render.test.js.snap

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@ exports[`debug 1`] = `
2929
<View
3030
accessible={true}
3131
focusable={true}
32-
isTVSelectable={true}
33-
onClick={[Function bound touchableHandlePress]}
34-
onResponderGrant={[Function bound touchableHandleResponderGrant]}
35-
onResponderMove={[Function bound touchableHandleResponderMove]}
36-
onResponderRelease={[Function bound touchableHandleResponderRelease]}
37-
onResponderTerminate={[Function bound touchableHandleResponderTerminate]}
38-
onResponderTerminationRequest={[Function bound touchableHandleResponderTerminationRequest]}
39-
onStartShouldSetResponder={[Function bound touchableHandleStartShouldSetResponder]}
32+
onClick={[Function onClick]}
33+
onResponderGrant={[Function onResponderGrant]}
34+
onResponderMove={[Function onResponderMove]}
35+
onResponderRelease={[Function onResponderRelease]}
36+
onResponderTerminate={[Function onResponderTerminate]}
37+
onResponderTerminationRequest={[Function onResponderTerminationRequest]}
38+
onStartShouldSetResponder={[Function onStartShouldSetResponder]}
4039
style={
4140
Object {
4241
\\"opacity\\": 1,
@@ -92,14 +91,13 @@ exports[`debug changing component: bananaFresh button message should now be "fre
9291
<View
9392
accessible={true}
9493
focusable={true}
95-
isTVSelectable={true}
96-
onClick={[Function bound touchableHandlePress]}
97-
onResponderGrant={[Function bound touchableHandleResponderGrant]}
98-
onResponderMove={[Function bound touchableHandleResponderMove]}
99-
onResponderRelease={[Function bound touchableHandleResponderRelease]}
100-
onResponderTerminate={[Function bound touchableHandleResponderTerminate]}
101-
onResponderTerminationRequest={[Function bound touchableHandleResponderTerminationRequest]}
102-
onStartShouldSetResponder={[Function bound touchableHandleStartShouldSetResponder]}
94+
onClick={[Function onClick]}
95+
onResponderGrant={[Function onResponderGrant]}
96+
onResponderMove={[Function onResponderMove]}
97+
onResponderRelease={[Function onResponderRelease]}
98+
onResponderTerminate={[Function onResponderTerminate]}
99+
onResponderTerminationRequest={[Function onResponderTerminationRequest]}
100+
onStartShouldSetResponder={[Function onStartShouldSetResponder]}
103101
style={
104102
Object {
105103
\\"opacity\\": 1,
@@ -136,15 +134,15 @@ exports[`debug: shallow 1`] = `
136134
>
137135
not fresh
138136
</Text>
139-
<TextInput
137+
<Component
140138
allowFontScaling={true}
141139
placeholder=\\"Add custom freshness\\"
142140
rejectResponderTermination={true}
143141
testID=\\"bananaCustomFreshness\\"
144142
underlineColorAndroid=\\"transparent\\"
145143
value=\\"Custom Freshie\\"
146144
/>
147-
<TextInput
145+
<Component
148146
allowFontScaling={true}
149147
placeholder=\\"Who inspected freshness?\\"
150148
rejectResponderTermination={true}
@@ -186,15 +184,15 @@ exports[`debug: shallow with message 1`] = `
186184
>
187185
not fresh
188186
</Text>
189-
<TextInput
187+
<Component
190188
allowFontScaling={true}
191189
placeholder=\\"Add custom freshness\\"
192190
rejectResponderTermination={true}
193191
testID=\\"bananaCustomFreshness\\"
194192
underlineColorAndroid=\\"transparent\\"
195193
value=\\"Custom Freshie\\"
196194
/>
197-
<TextInput
195+
<Component
198196
allowFontScaling={true}
199197
placeholder=\\"Who inspected freshness?\\"
200198
rejectResponderTermination={true}
@@ -255,14 +253,13 @@ exports[`debug: with message 1`] = `
255253
<View
256254
accessible={true}
257255
focusable={true}
258-
isTVSelectable={true}
259-
onClick={[Function bound touchableHandlePress]}
260-
onResponderGrant={[Function bound touchableHandleResponderGrant]}
261-
onResponderMove={[Function bound touchableHandleResponderMove]}
262-
onResponderRelease={[Function bound touchableHandleResponderRelease]}
263-
onResponderTerminate={[Function bound touchableHandleResponderTerminate]}
264-
onResponderTerminationRequest={[Function bound touchableHandleResponderTerminationRequest]}
265-
onStartShouldSetResponder={[Function bound touchableHandleStartShouldSetResponder]}
256+
onClick={[Function onClick]}
257+
onResponderGrant={[Function onResponderGrant]}
258+
onResponderMove={[Function onResponderMove]}
259+
onResponderRelease={[Function onResponderRelease]}
260+
onResponderTerminate={[Function onResponderTerminate]}
261+
onResponderTerminationRequest={[Function onResponderTerminationRequest]}
262+
onStartShouldSetResponder={[Function onStartShouldSetResponder]}
266263
style={
267264
Object {
268265
\\"opacity\\": 1,
@@ -293,7 +290,6 @@ exports[`toJSON 1`] = `
293290
<View
294291
accessible={true}
295292
focusable={false}
296-
isTVSelectable={true}
297293
onClick={[Function]}
298294
onResponderGrant={[Function]}
299295
onResponderMove={[Function]}

src/__tests__/a11yAPI.test.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ test('getAllByA11yRole, queryAllByA11yRole', () => {
132132
expect(queryAllByA11yRole(NO_MATCHES_TEXT)).toEqual([]);
133133
});
134134

135-
test('getByA11yStates, queryByA11yStates', () => {
135+
// TODO: accessibilityStates was removed from RN 0.62
136+
test.skip('getByA11yStates, queryByA11yStates', () => {
136137
const { getByA11yStates, queryByA11yStates } = render(<Section />);
137138

138139
expect(getByA11yStates('disabled').props.accessibilityStates).toEqual([
@@ -157,7 +158,8 @@ test('getByA11yStates, queryByA11yStates', () => {
157158
expect(() => queryByA11yStates('selected')).toThrow(FOUND_TWO_INSTANCES);
158159
});
159160

160-
test('getAllByA11yStates, queryAllByA11yStates', () => {
161+
// TODO: accessibilityStates was removed from RN 0.62
162+
test.skip('getAllByA11yStates, queryAllByA11yStates', () => {
161163
const { getAllByA11yStates, queryAllByA11yStates } = render(<Section />);
162164

163165
expect(getAllByA11yStates('selected')).toHaveLength(3);

src/__tests__/fireEvent.test.js

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ describe('fireEvent', () => {
5757
});
5858

5959
test('should throw an Error when event handler was not found', () => {
60-
const { getByTestId } = render(<WithoutEventComponent />);
60+
const { getByTestId } = render(
61+
<WithoutEventComponent onPress={() => 'this is not passed to children'} />
62+
);
6163

6264
expect(() => fireEvent(getByTestId('text'), 'press')).toThrow(
6365
'No handler function found for event: "press"'
@@ -78,18 +80,6 @@ describe('fireEvent', () => {
7880

7981
expect(handlerMock).toHaveBeenCalledWith(EVENT_DATA);
8082
});
81-
82-
test('should not bubble event to root element', () => {
83-
const onPressMock = jest.fn();
84-
const { getByTestId } = render(
85-
<TouchableOpacity onPress={onPressMock}>
86-
<Text testID="test">Content</Text>
87-
</TouchableOpacity>
88-
);
89-
90-
expect(() => fireEvent.press(getByTestId('test'))).toThrow();
91-
expect(onPressMock).not.toHaveBeenCalled();
92-
});
9383
});
9484

9585
test('fireEvent.press', () => {

0 commit comments

Comments
 (0)