This repository was archived by the owner on Oct 8, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +68
-1955
lines changed Expand file tree Collapse file tree 6 files changed +68
-1955
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
22import uuidV4 from 'uuid/v4' ;
3+ import PropTypes from 'prop-types' ;
34
45export default class ReactFileReader extends React . Component {
56
@@ -86,9 +87,9 @@ ReactFileReader.defaultProps = {
8687} ;
8788
8889ReactFileReader . propTypes = {
89- multipleFiles : React . PropTypes . bool ,
90- handleFiles : React . PropTypes . func . isRequired ,
91- fileTypes : React . PropTypes . string ,
92- base64 : React . PropTypes . bool ,
93- children : React . PropTypes . element . isRequired
90+ multipleFiles : PropTypes . bool ,
91+ handleFiles : PropTypes . func . isRequired ,
92+ fileTypes : PropTypes . string ,
93+ base64 : PropTypes . bool ,
94+ children : PropTypes . element . isRequired
9495}
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import ReactFileReader from '../ReactFileReader' ;
3+ import renderer from 'react-test-renderer' ;
4+
5+ test ( 'the component renders' , ( ) => {
6+ const component = renderer . create (
7+ < ReactFileReader handleFiles = { ( ) => '' } >
8+ < p > Upload</ p >
9+ </ ReactFileReader >
10+ ) ;
11+
12+ let tree = component . toJSON ( ) ;
13+ expect ( tree ) . toMatchSnapshot ( ) ;
14+ } ) ;
Original file line number Diff line number Diff line change 1+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+ exports [` the component renders 1` ] = `
4+ <div
5+ className = " react-file-reader"
6+ >
7+ <input
8+ accept = " image/*"
9+ className = " react-file-reader-input"
10+ id = " 452c5f78-da74-4d6e-bc13-fcf46b622208"
11+ multiple = { undefined }
12+ onChange = { [Function ]}
13+ style = {
14+ Object {
15+ " left" : " -99999999px" ,
16+ " opacity" : " 0px" ,
17+ " position" : " fixed" ,
18+ " width" : " 0px" ,
19+ }
20+ }
21+ type = " file"
22+ />
23+ <div
24+ className = " react-file-reader-button"
25+ onClick = { [Function ]}
26+ >
27+ <p >
28+ Upload
29+ </p >
30+ </div >
31+ </div >
32+ ` ;
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ var _v = require('uuid/v4');
1414
1515var _v2 = _interopRequireDefault ( _v ) ;
1616
17+ var _propTypes = require ( 'prop-types' ) ;
18+
19+ var _propTypes2 = _interopRequireDefault ( _propTypes ) ;
20+
1721function _interopRequireDefault ( obj ) { return obj && obj . __esModule ? obj : { default : obj } ; }
1822
1923function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
@@ -132,9 +136,9 @@ ReactFileReader.defaultProps = {
132136} ;
133137
134138ReactFileReader . propTypes = {
135- multipleFiles : _react2 . default . PropTypes . bool ,
136- handleFiles : _react2 . default . PropTypes . func . isRequired ,
137- fileTypes : _react2 . default . PropTypes . string ,
138- base64 : _react2 . default . PropTypes . bool ,
139- children : _react2 . default . PropTypes . element . isRequired
139+ multipleFiles : _propTypes2 . default . bool ,
140+ handleFiles : _propTypes2 . default . func . isRequired ,
141+ fileTypes : _propTypes2 . default . string ,
142+ base64 : _propTypes2 . default . bool ,
143+ children : _propTypes2 . default . element . isRequired
140144} ;
Original file line number Diff line number Diff line change 77 "author" : " Grillwork Inc" ,
88 "license" : " MIT" ,
99 "dependencies" : {
10+ "prop-types" : " ^15.5.4" ,
1011 "react" : " ^15.4.2" ,
1112 "react-dom" : " ^15.4.2" ,
1213 "uuid4" : " ^1.0.0"
1314 },
15+ "scripts" : {
16+ "test" : " jest"
17+ },
1418 "scripts" : {
1519 "build" : " ./node_modules/.bin/babel ReactFileReader.js -o index.js" ,
1620 "prepublish" : " npm run build"
2125 "babel-loader" : " ^6.2.4" ,
2226 "babel-preset-es2015" : " ^6.24.0" ,
2327 "babel-preset-react" : " ^6.23.0" ,
24- "babel-preset-stage-0" : " ^6.22.0"
28+ "babel-preset-stage-0" : " ^6.22.0" ,
29+ "jest" : " ^19.0.2" ,
30+ "react-test-renderer" : " ^15.5.3"
2531 }
2632}
You can’t perform that action at this time.
0 commit comments