diff --git a/.eslintrc b/.eslintrc index 933aa11..3d946ff 100644 --- a/.eslintrc +++ b/.eslintrc @@ -2,13 +2,14 @@ "settings": { "react": { "pragma": "React", - "version": "16.0" + "version": "latest" } }, "extends": ["standard", "standard-react", "plugin:jest/recommended"], - "plugins": ["jest"], + "plugins": ["react","jest"], rules: { 'jest/valid-expect': 0, 'react/jsx-boolean-value': 0 - } + }, + parser: "babel-eslint" } diff --git a/package-lock.json b/package-lock.json index c2a0724..c47d4ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16993,6 +16993,19 @@ } } }, + "react-router-dom": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-4.3.1.tgz", + "integrity": "sha512-c/MlywfxDdCp7EnB7YfPMOfMD3tOtIjrQlj/CKfNMBxdmpJP8xcz5P/UAFn3JbnQCNUxsHyVVqllF9LhgVyFCA==", + "requires": { + "history": "^4.7.2", + "invariant": "^2.2.4", + "loose-envify": "^1.3.1", + "prop-types": "^15.6.1", + "react-router": "^4.3.1", + "warning": "^4.0.1" + } + }, "react-side-effect": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/react-side-effect/-/react-side-effect-1.1.5.tgz", diff --git a/package.json b/package.json index ab961a4..22b6b4a 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "storybook": "start-storybook -p 6006", "dev": "NODE_ENV=development PORT=3333 webpack-serve --config ./webpack.config.js", "build": "NODE_ENV=production webpack --mode production --config ./webpack.config.js", - "lint": "prettier-standard 'packages/*/src/**/*.js'", + "lint": "prettier-standard 'src/**/*.js'", "build-storybook": "build-storybook" }, "peerDependencies": { @@ -45,7 +45,7 @@ "react-dom": "^16.6.3", "react-dropzone": "^5.1.0", "react-helmet": "^5.2.0", - "react-router": "^4.3.1" + "react-router-dom": "^4.3.1" }, "devDependencies": { "@babel/cli": "^7.2.0", diff --git a/src/image-upload/__tests__/CropperDialog.test.js b/src/image-upload/__tests__/CropperDialog.test.js index 1c9a7c8..6af9a1d 100644 --- a/src/image-upload/__tests__/CropperDialog.test.js +++ b/src/image-upload/__tests__/CropperDialog.test.js @@ -13,25 +13,29 @@ const cropPreview = { width: 350, height: 350 } -const placeHolder = 'data:image/svg+xml;charset=UTF-8,%3Csvg%20width%3D%22288%22%20height%3D%22225%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20288%20225%22%20preserveAspectRatio%3D%22none%22%3E%3Cdefs%3E%3Cstyle%20type%3D%22text%2Fcss%22%3E%23holder_164edaf95ee%20text%20%7B%20fill%3A%23eceeef%3Bfont-weight%3Abold%3Bfont-family%3AArial%2C%20Helvetica%2C%20Open%20Sans%2C%20sans-serif%2C%20monospace%3Bfont-size%3A14pt%20%7D%20%3C%2Fstyle%3E%3C%2Fdefs%3E%3Cg%20id%3D%22holder_164edaf95ee%22%3E%3Crect%20width%3D%22288%22%20height%3D%22225%22%20fill%3D%22%2355595c%22%3E%3C%2Frect%3E%3Cg%3E%3Ctext%20x%3D%2296.32500076293945%22%20y%3D%22118.8%22%3EAvatar%3C%2Ftext%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E' +const placeHolder = + 'https://aadevelop.blob.core.windows.net/module-web-components/assets/aa-logo.png' const ComponentNaked = unwrap(CropperDialog) describe('CropperDialog tests', () => { it('with shallow', () => { - const wrapper = shallow( this.instance()} - cropRatio={1} - classes={{ - dialogContainer: '', - cropImageBox: '' - }} - />) + const wrapper = shallow( + this.instance()} + cropRatio={1} + classes={{ + dialogContainer: '', + cropImageBox: '' + }} + /> + ) console.log('shallow', wrapper.debug()) expect(wrapper.find('CropperDialog')).toBeDefined() }) @@ -46,7 +50,7 @@ describe('CropperDialog tests', () => { handleCrop={handleCropMock} handleCancel={handleCancelMock} cropImagePreview={cropPreview} - cropperRef={(e) => this.instance()} + cropperRef={e => this.instance()} cropRatio={1} classes={{ dialogContainer: '', @@ -68,7 +72,7 @@ describe('CropperDialog tests', () => { handleCrop={handleCropMock} handleCancel={handleCancelMock} cropImagePreview={cropPreview} - cropperRef={(e) => this.instance()} + cropperRef={e => this.instance()} cropRatio={1} classes={{ dialogContainer: '', @@ -89,7 +93,7 @@ describe('CropperDialog tests', () => { handleCrop={handleCropMock} handleCancel={handleCancelMock} cropImagePreview={cropPreview} - cropperRef={(e) => this.instance()} + cropperRef={e => this.instance()} cropRatio={1} classes={{ dialogContainer: '', diff --git a/src/image-upload/components/CropperDialog.js b/src/image-upload/components/CropperDialog.js index 5876ca1..c773725 100644 --- a/src/image-upload/components/CropperDialog.js +++ b/src/image-upload/components/CropperDialog.js @@ -29,7 +29,14 @@ class CropperDialog extends Component { } render () { - const { classes, open, handleClose, imgSrc, handleCancel, cropRatio } = this.props + const { + classes, + open, + handleClose, + imgSrc, + handleCancel, + cropRatio + } = this.props return (
-
- {imgSrc === null && ( -
Loading...
- )} +
+ {imgSrc === null &&
Loading...
} {imgSrc !== null && ( Cancel - diff --git a/src/image-upload/components/DropZone.js b/src/image-upload/components/DropZone.js index 31f4617..135864e 100644 --- a/src/image-upload/components/DropZone.js +++ b/src/image-upload/components/DropZone.js @@ -36,12 +36,14 @@ export const DropZone = ({ classes, onDrop, handleCancel, dropzoneStyle }) => ( onDrop(e)} + onDrop={e => onDrop(e)} className={classes.dropzone} multiple={false} style={{ height: dropzoneStyle.height ? dropzoneStyle.height : 200 }} > -

Drag *.jpeg or *.png image here or click to select

+

+ Drag *.jpeg or *.png image here or click to select +