Skip to content

Commit aee06f3

Browse files
committed
fix: fix chip snapshot tests
1 parent a95eb10 commit aee06f3

File tree

2 files changed

+104
-53
lines changed

2 files changed

+104
-53
lines changed

src/components/__tests__/Chip.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ it('renders chip with icon', () => {
1818
expect(tree).toMatchSnapshot();
1919
});
2020

21-
it('renders deletable chip', () => {
21+
it('renders chip with close button', () => {
2222
const tree = renderer
2323
.create(
24-
<Chip icon="info" onDelete={() => {}}>
24+
<Chip icon="info" onClose={() => {}}>
2525
Example Chip
2626
</Chip>
2727
)

src/components/__tests__/__snapshots__/Chip.test.js.snap

+102-51
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`renders chip with icon 1`] = `
3+
exports[`renders chip with close button 1`] = `
44
<View
55
style={
66
Object {
@@ -104,20 +104,71 @@ exports[`renders chip with icon 1`] = `
104104
Object {
105105
"color": "rgba(0, 0, 0, 0.87)",
106106
"marginLeft": 4,
107-
"marginRight": 8,
107+
"marginRight": 4,
108108
},
109109
],
110110
]
111111
}
112112
>
113113
Example Chip
114114
</Text>
115+
<View
116+
accessibilityComponentType="button"
117+
accessibilityTraits="button"
118+
accessible={true}
119+
onResponderGrant={[Function]}
120+
onResponderMove={[Function]}
121+
onResponderRelease={[Function]}
122+
onResponderTerminate={[Function]}
123+
onResponderTerminationRequest={[Function]}
124+
onStartShouldSetResponder={[Function]}
125+
style={
126+
Object {
127+
"padding": 4,
128+
}
129+
}
130+
>
131+
<Text
132+
accessibilityElementsHidden={true}
133+
allowFontScaling={false}
134+
importantForAccessibility="no-hide-descendants"
135+
pointerEvents="none"
136+
style={
137+
Array [
138+
Object {
139+
"color": "rgba(0, 0, 0, 0.54)",
140+
"fontSize": 16,
141+
},
142+
Array [
143+
Object {
144+
"transform": Array [
145+
Object {
146+
"scaleX": 1,
147+
},
148+
],
149+
},
150+
Object {
151+
"backgroundColor": "transparent",
152+
},
153+
],
154+
Object {
155+
"fontFamily": "Material Icons",
156+
"fontStyle": "normal",
157+
"fontWeight": "normal",
158+
},
159+
Object {},
160+
]
161+
}
162+
>
163+
164+
</Text>
165+
</View>
115166
</View>
116167
</View>
117168
</View>
118169
`;
119170

120-
exports[`renders chip with onPress 1`] = `
171+
exports[`renders chip with icon 1`] = `
121172
<View
122173
style={
123174
Object {
@@ -156,6 +207,51 @@ exports[`renders chip with onPress 1`] = `
156207
}
157208
}
158209
>
210+
<View
211+
style={
212+
Array [
213+
Object {
214+
"padding": 4,
215+
},
216+
null,
217+
]
218+
}
219+
>
220+
<Text
221+
accessibilityElementsHidden={true}
222+
allowFontScaling={false}
223+
importantForAccessibility="no-hide-descendants"
224+
pointerEvents="none"
225+
style={
226+
Array [
227+
Object {
228+
"color": "rgba(0, 0, 0, 0.54)",
229+
"fontSize": 18,
230+
},
231+
Array [
232+
Object {
233+
"transform": Array [
234+
Object {
235+
"scaleX": 1,
236+
},
237+
],
238+
},
239+
Object {
240+
"backgroundColor": "transparent",
241+
},
242+
],
243+
Object {
244+
"fontFamily": "Material Icons",
245+
"fontStyle": "normal",
246+
"fontWeight": "normal",
247+
},
248+
Object {},
249+
]
250+
}
251+
>
252+
253+
</Text>
254+
</View>
159255
<Text
160256
numberOfLines={1}
161257
style={
@@ -175,7 +271,7 @@ exports[`renders chip with onPress 1`] = `
175271
},
176272
Object {
177273
"color": "rgba(0, 0, 0, 0.87)",
178-
"marginLeft": 8,
274+
"marginLeft": 4,
179275
"marginRight": 8,
180276
},
181277
],
@@ -189,7 +285,7 @@ exports[`renders chip with onPress 1`] = `
189285
</View>
190286
`;
191287

192-
exports[`renders deletable chip 1`] = `
288+
exports[`renders chip with onPress 1`] = `
193289
<View
194290
style={
195291
Object {
@@ -228,51 +324,6 @@ exports[`renders deletable chip 1`] = `
228324
}
229325
}
230326
>
231-
<View
232-
style={
233-
Array [
234-
Object {
235-
"padding": 4,
236-
},
237-
null,
238-
]
239-
}
240-
>
241-
<Text
242-
accessibilityElementsHidden={true}
243-
allowFontScaling={false}
244-
importantForAccessibility="no-hide-descendants"
245-
pointerEvents="none"
246-
style={
247-
Array [
248-
Object {
249-
"color": "rgba(0, 0, 0, 0.54)",
250-
"fontSize": 18,
251-
},
252-
Array [
253-
Object {
254-
"transform": Array [
255-
Object {
256-
"scaleX": 1,
257-
},
258-
],
259-
},
260-
Object {
261-
"backgroundColor": "transparent",
262-
},
263-
],
264-
Object {
265-
"fontFamily": "Material Icons",
266-
"fontStyle": "normal",
267-
"fontWeight": "normal",
268-
},
269-
Object {},
270-
]
271-
}
272-
>
273-
274-
</Text>
275-
</View>
276327
<Text
277328
numberOfLines={1}
278329
style={
@@ -292,7 +343,7 @@ exports[`renders deletable chip 1`] = `
292343
},
293344
Object {
294345
"color": "rgba(0, 0, 0, 0.87)",
295-
"marginLeft": 4,
346+
"marginLeft": 8,
296347
"marginRight": 8,
297348
},
298349
],

0 commit comments

Comments
 (0)