我正在研究使用笑话的测试。幸运的是,我可以使用笑话来测试视图。
但是,我不知道tsx.snap
文件有多有用。下面是代码:
exports[`renders correctly with defaults 1`] = `
<View
style={
Object {
"alignItems": "center",
"alignSelf": "center",
}
}
>
<Text
style={
Object {
"color": "#999",
"fontWeight": "bold",
}
}
>
Hello
World!
</Text>
<View
style={
Object {
"alignItems": "stretch",
"alignSelf": "center",
"borderWidth": 5,
"flexDirection": "row",
"minHeight": 70,
}
}
>
<View
style={
Object {
"flex": 1,
"paddingVertical": 0,
}
}
>
<View
accessibilityLabel="decrement"
accessibilityRole="button"
accessibilityStates={Array []}
accessible={true}
focusable={true}
isTVSelectable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"opacity": 1,
}
}
>
<View
style={
Array [
Object {},
]
}
>
<Text
style={
Array [
Object {
"color": "#007AFF",
"fontSize": 18,
"padding": 8,
"textAlign": "center",
},
Object {
"color": "red",
},
]
}
>
-
</Text>
</View>
</View>
</View>
<View
style={
Object {
"flex": 1,
"paddingVertical": 0,
}
}
>
<View
accessibilityLabel="increment"
accessibilityRole="button"
accessibilityStates={Array []}
accessible={true}
focusable={true}
isTVSelectable={true}
onClick={[Function]}
onResponderGrant={[Function]}
onResponderMove={[Function]}
onResponderRelease={[Function]}
onResponderTerminate={[Function]}
onResponderTerminationRequest={[Function]}
onStartShouldSetResponder={[Function]}
style={
Object {
"opacity": 1,
}
}
>
<View
style={
Array [
Object {},
]
}
>
<Text
style={
Array [
Object {
"color": "#007AFF",
"fontSize": 18,
"padding": 8,
"textAlign": "center",
},
Object {
"color": "blue",
},
]
}
>
+
</Text>
</View>
</View>
</View>
</View>
</View>
`;
对于我来说,该文件告诉我们有关样式如何应用于视图的信息。
如果您知道tsx.snap
的用处,请告诉我。
提前谢谢!