Created
February 16, 2017 00:35
-
-
Save alexbrillant/1b0a79bb6cc45cee3318cc130a705282 to your computer and use it in GitHub Desktop.
Circle transition animation jest test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'react-native' | |
import React from 'react' | |
import CircleTransition from '../CircleTransition.js' | |
// Note: test renderer must be required after react-native. | |
import renderer from 'react-test-renderer' | |
const positionTest = (position) => { | |
const tree = renderer.create( | |
<CircleTransition | |
color={'orange'} | |
position={position} | |
expand | |
callback={() => { | |
console.log('transition done callback') | |
}} | |
customLeftMargin={100} | |
customTopMargin={100} | |
/> | |
).toJSON() | |
expect(tree).toMatchSnapshot() | |
} | |
it('renders correctly with default props', () => { | |
const tree = renderer.create( | |
<CircleTransition callback={() => { | |
console.log('transition done callback') | |
}} /> | |
) | |
}) | |
it('renders correctly when position is center', () => { | |
positionTest('center') | |
}) | |
// other positions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment