Skip to content

Commit f4696c2

Browse files
authored
chore: Test fallback prop. (#413)
1 parent c3492fc commit f4696c2

File tree

4 files changed

+647
-471
lines changed

4 files changed

+647
-471
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,16 @@
3737
}
3838
},
3939
"devDependencies": {
40-
"@babel/core": "^7.1.6",
40+
"@babel/core": "^7.3.3",
4141
"@semantic-release/changelog": "^3.0.2",
4242
"@semantic-release/commit-analyzer": "^6.1.0",
4343
"@semantic-release/git": "^7.0.7",
4444
"@semantic-release/npm": "^5.1.3",
4545
"@semantic-release/release-notes-generator": "^7.1.4",
46-
"babel-jest": "^23.6.0",
46+
"babel-jest": "^24.1.0",
4747
"commitizen": "^3.0.5",
4848
"cz-conventional-changelog": "^2.1.0",
49-
"jest": "^23.6.0",
49+
"jest": "^24.1.0",
5050
"metro-react-native-babel-preset": "0.48.1",
5151
"prettier": "^1.15.3",
5252
"prettier-check": "^2.0.0",

src/__snapshots__/index.test.js.snap

+34
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,40 @@ exports[`FastImage renders correctly. 1`] = `
3838
</View>
3939
`;
4040

41+
exports[`Renders Image with fallback prop. 1`] = `
42+
<View
43+
style={
44+
Array [
45+
Object {
46+
"overflow": "hidden",
47+
},
48+
Object {
49+
"height": 44,
50+
"width": 44,
51+
},
52+
]
53+
}
54+
>
55+
<FastImageView
56+
resizeMode="cover"
57+
source={
58+
Object {
59+
"testUri": "../../../react-native-fast-image-example-server/pictures/jellyfish.gif",
60+
}
61+
}
62+
style={
63+
Object {
64+
"bottom": 0,
65+
"left": 0,
66+
"position": "absolute",
67+
"right": 0,
68+
"top": 0,
69+
}
70+
}
71+
/>
72+
</View>
73+
`;
74+
4175
exports[`Renders a normal Image when not passed a uri. 1`] = `
4276
<View
4377
style={

src/index.test.js

+14
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,17 @@ test('Renders a normal Image when not passed a uri.', () => {
3636

3737
expect(tree).toMatchSnapshot()
3838
})
39+
40+
test('Renders Image with fallback prop.', () => {
41+
const tree = renderer
42+
.create(
43+
<FastImage
44+
source={require('../react-native-fast-image-example-server/pictures/jellyfish.gif')}
45+
style={style.image}
46+
fallback
47+
/>,
48+
)
49+
.toJSON()
50+
51+
expect(tree).toMatchSnapshot()
52+
})

0 commit comments

Comments
 (0)