Created
September 27, 2017 08:05
-
-
Save javidjamae/3028d5bd1fd749f375efa96ea434583c to your computer and use it in GitHub Desktop.
Mocking out a TextInput with jest
This file contains hidden or 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
jest.mock( 'TextInput', () => { | |
const RealComponent = require.requireActual( 'TextInput' ) | |
const React = require( 'React' ) | |
class TextInput extends React.Component { | |
render() { | |
delete this.props.autoFocus | |
return React.createElement( 'TextInput', this.props, this.props.children ) | |
} | |
} | |
TextInput.propTypes = RealComponent.propTypes | |
return TextInput | |
} ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment