filestack-react
Advanced tools
Comparing version 1.3.9 to 2.0.0
@@ -1,3 +0,7 @@ | ||
## 1.0.0 (June, 10, 2017) | ||
## 2.0.0 (June 6, 2018) | ||
Updated to support filestack-js 1.0 and React 16.0 as peer dependencies. | ||
## 1.0.0 (June 10, 2017) | ||
Officially changed name to filestack-react | ||
@@ -4,0 +8,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("filestack-js"),require("prop-types"),require("react"));else if("function"==typeof define&&define.amd)define(["filestack-js","prop-types","react"],t);else{var n="object"==typeof exports?t(require("filestack-js"),require("prop-types"),require("react")):t(e["filestack-js"],e["prop-types"],e.react);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(this,function(e,t,n){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(4),a=r(l),f=n(0),s=r(f),p=n(3),d=r(p),y=function(e){function t(){var e,n,r,i;o(this,t);for(var c=arguments.length,l=Array(c),a=0;a<c;a++)l[a]=arguments[a];return n=r=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),r.onClickPick=function(e){e.stopPropagation(),e.preventDefault();var t=r.props,n=t.apikey,o=t.onSuccess,u=t.onError,i=t.options,c=t.mode,l=t.file,a=t.security,f=t.cname,s=function(e){"function"==typeof o?o(e):console.log(e)},p=function(e){"function"==typeof u?u(e):console.error(e)};r.initClient(c,n,i,l,a,f).then(s).catch(p)},r.initClient=function(e,t,n,r,o,u){var i=n.url,c=n.handle;delete n.handle,delete n.url;var l=s.default.init(t,o,u);return"transform"===e?new Promise(function(e,t){try{e(l.transform(i,n))}catch(e){t(e)}}):"retrieve"===e?l.retrieve(c,n):"metadata"===e?l.metadata(c,n):"storeUrl"===e?l.storeURL(i,n):"upload"===e?l.upload(r,n):"remove"===e?l.remove(c,o):l.pick(n)},i=n,u(r,i)}return i(t,e),c(t,[{key:"render",value:function(){var e=this.props,t=e.buttonClass,n=e.buttonText,r=e.link,o=e.children,u=e.render;if(u)return a.default.createElement(u,{onPick:this.onClickPick});var i=r?"a":"button";return a.default.createElement(i,{name:"filestack",onClick:this.onClickPick,className:t},o||n)}}]),t}(l.Component);y.defaultProps={file:null,link:!1,buttonText:"Pick file",buttonClass:"",onSuccess:function(e){return console.log(e)},onError:function(e){return console.error(e)},mode:"pick",options:{},security:null,children:null,render:null,cname:null},y.propTypes={file:d.default.objectOf(d.default.any),apikey:d.default.string.isRequired,link:d.default.bool,mode:d.default.string,buttonText:d.default.string,buttonClass:d.default.string,onSuccess:d.default.func,onError:d.default.func,options:d.default.objectOf(d.default.any),security:d.default.objectOf(d.default.any),children:d.default.node,render:d.default.func,cname:d.default.string},t.default=y},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.client=void 0;var o=n(1),u=r(o),i=n(0),c=r(i);t.default=u.default,t.client=c.default},function(e,n){e.exports=t},function(e,t){e.exports=n}])}); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("filestack-js"),require("prop-types"),require("react"));else if("function"==typeof define&&define.amd)define(["filestack-js","prop-types","react"],t);else{var n="object"==typeof exports?t(require("filestack-js"),require("prop-types"),require("react")):t(e["filestack-js"],e["prop-types"],e.react);for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(this,function(e,t,n){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=2)}([function(t,n){t.exports=e},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(4),f=r(l),s=n(0),p=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(s),d=n(3),y=r(d),b=function(e){function t(){var e,n,r,i;o(this,t);for(var a=arguments.length,l=Array(a),f=0;f<a;f++)l[f]=arguments[f];return n=r=u(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(l))),r.onClickPick=function(e){e.stopPropagation(),e.preventDefault();var t=r.props,n=t.apikey,o=t.onSuccess,u=t.onError,i=t.options,c=t.mode,a=t.file,l=t.security,f=t.cname,s=t.sessionCache,p=function(e){"function"==typeof o?o(e):console.log(e)},d=function(e){"function"==typeof u?u(e):console.error(e)};r.initClient(c,n,i,a,l,f,s).then(p).catch(d)},r.initClient=function(e,t,n,r,o,u,i){var a=n.url,l=n.handle;delete n.handle,delete n.url;var f=p.init(t,{security:o,cname:u,sessionCache:i});return"transform"===e?new Promise(function(e,t){try{e(f.transform(l,n))}catch(e){t(e)}}):"retrieve"===e?f.retrieve(l,n):"metadata"===e?f.metadata(l,n):"storeUrl"===e?f.storeURL(a,n):"upload"===e?f.upload(r,n):"remove"===e?f.remove(l,o):new Promise(function(e){f.picker(c({},n,{onUploadDone:e})).open()})},i=n,u(r,i)}return i(t,e),a(t,[{key:"render",value:function(){var e=this.props,t=e.buttonClass,n=e.buttonText,r=e.link,o=e.children,u=e.render;if(u)return f.default.createElement(u,{onPick:this.onClickPick});var i=r?"a":"button";return f.default.createElement(i,{name:"filestack",onClick:this.onClickPick,className:t},o||n)}}]),t}(l.Component);b.defaultProps={file:null,link:!1,buttonText:"Pick file",buttonClass:"",onSuccess:function(e){return console.log(e)},onError:function(e){return console.error(e)},mode:"pick",options:{},security:null,children:null,render:null,cname:null,sessionCache:!1},b.propTypes={file:y.default.objectOf(y.default.any),apikey:y.default.string.isRequired,link:y.default.bool,mode:y.default.string,buttonText:y.default.string,buttonClass:y.default.string,onSuccess:y.default.func,onError:y.default.func,options:y.default.objectOf(y.default.any),security:y.default.objectOf(y.default.any),children:y.default.node,render:y.default.func,cname:y.default.string,sessionCache:y.default.bool},t.default=b},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.client=void 0;var r=n(0),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(r),u=n(1),i=function(e){return e&&e.__esModule?e:{default:e}}(u);t.default=i.default,t.client=o},function(e,n){e.exports=t},function(e,t){e.exports=n}])}); | ||
//# sourceMappingURL=filestack-react.js.map |
import React from 'react'; | ||
import { render } from 'react-dom'; | ||
import { client } from '../../src'; | ||
import Container from './components/Container'; | ||
import Container from './src/Container'; | ||
const apikey = 'Acu94EFL1STGYvkM6a8usz'; | ||
render ( | ||
render( | ||
<Container apikey={apikey} />, | ||
@@ -10,0 +10,0 @@ document.getElementById('app'), |
@@ -6,3 +6,3 @@ { | ||
"author": "Sam Zaza", | ||
"email" : "zaza.samuele@gmail.com", | ||
"email": "zaza.samuele@gmail.com", | ||
"license": "MIT", | ||
@@ -29,5 +29,5 @@ "scripts": { | ||
"prop-types": "^15.5.10", | ||
"react": "^15.6.1", | ||
"react-dom": "^15.6.1" | ||
"react": "^16.4.0", | ||
"react-dom": "^16.4.0" | ||
} | ||
} |
const path = require('path'); | ||
const webpack = require('webpack'); | ||
const fs = require('fs'); | ||
const rules = require('./webpack.loaders'); | ||
@@ -10,3 +9,3 @@ | ||
path: path.join(__dirname, 'dist'), | ||
filename: 'demo.js' | ||
filename: 'demo.js', | ||
}, | ||
@@ -19,3 +18,3 @@ devtool: 'source-map', | ||
module: { rules }, | ||
devServer:{ | ||
devServer: { | ||
historyApiFallback: true, | ||
@@ -31,3 +30,3 @@ hot: true, | ||
new webpack.HotModuleReplacementPlugin({ | ||
multistep: true | ||
multistep: true, | ||
}), | ||
@@ -34,0 +33,0 @@ ], |
import React from 'react'; | ||
import { render } from 'react-dom'; | ||
import { client } from '../../src'; | ||
import Container from './components/Container'; | ||
import Container from './src/Container'; | ||
const apikey = 'Acu94EFL1STGYvkM6a8usz'; | ||
render ( | ||
render( | ||
<Container apikey={apikey} />, | ||
@@ -10,0 +10,0 @@ document.getElementById('app'), |
@@ -6,3 +6,3 @@ { | ||
"author": "Sam Zaza", | ||
"email" : "zaza.samuele@gmail.com", | ||
"email": "zaza.samuele@gmail.com", | ||
"license": "MIT", | ||
@@ -29,5 +29,5 @@ "scripts": { | ||
"prop-types": "^15.5.10", | ||
"react": "^15.6.1", | ||
"react-dom": "^15.6.1" | ||
"react": "^16.4.0", | ||
"react-dom": "^16.4.0" | ||
} | ||
} |
{ | ||
"name": "filestack-react", | ||
"version": "1.3.9", | ||
"version": "2.0.0", | ||
"main": "dist/filestack-react.js", | ||
"description": "react component for filestack", | ||
"description": "React component wrapper for filestack-js", | ||
"scripts": { | ||
"test": "jest --watch --no-cache --coverage", | ||
"build": "rimraf dist && webpack --colors -p --display-error-details", | ||
"prepublish": "npm run build", | ||
"prepare": "npm run build", | ||
"lint": "eslint" | ||
@@ -48,4 +48,5 @@ }, | ||
"css-loader": "^0.27.3", | ||
"enzyme": "^2.8.2", | ||
"enzyme-to-json": "^1.5.1", | ||
"enzyme": "^3.3.0", | ||
"enzyme-adapter-react-16": "^1.1.1", | ||
"enzyme-to-json": "^3.3.4", | ||
"eslint": "^3.18.0", | ||
@@ -58,10 +59,8 @@ "eslint-config-airbnb": "^14.1.0", | ||
"imports-loader": "^0.7.1", | ||
"jasmine-reporters": "^2.2.1", | ||
"jest-cli": "^20.0.3", | ||
"prop-types": "^15.5.10", | ||
"jest-cli": "^23.1.0", | ||
"prop-types": "^15.6.1", | ||
"raw-loader": "^0.5.1", | ||
"react": "^15.5.4", | ||
"react-addons-test-utils": "^15.5.1", | ||
"react-dom": "^15.5.4", | ||
"react-test-renderer": "^15.5.4", | ||
"react": "^16.4.0", | ||
"react-dom": "^16.4.0", | ||
"react-test-renderer": "^16.4.0", | ||
"rimraf": "^2.6.1", | ||
@@ -72,4 +71,4 @@ "style-loader": "^0.16.0", | ||
"peerDependencies": { | ||
"filestack-js": "^0.11.2", | ||
"react": "^15.5.4" | ||
"filestack-js": "^1.0.1", | ||
"react": "^16.4.0" | ||
}, | ||
@@ -80,2 +79,7 @@ "jest": { | ||
], | ||
"testPathIgnorePatterns": [ | ||
"<rootDir>/__tests__/__coverage__", | ||
"<rootDir>/__tests__/__mocks__", | ||
"<rootDir>/node_modules" | ||
], | ||
"moduleDirectories": [ | ||
@@ -85,4 +89,6 @@ "node_modules" | ||
"testRegex": "\\.(spec|e2e|snapshot)\\.js$", | ||
"collectCoverageFrom": [ | ||
"<rootDir>/src/**/*.{js,jsx}" | ||
], | ||
"coverageDirectory": "<rootDir>/tests/__coverage__/", | ||
"setupTestFrameworkScriptFile": "<rootDir>/setup-jasmine-env.js", | ||
"coverageReporters": [ | ||
@@ -95,11 +101,2 @@ "json", | ||
"moduleNameMapper": { | ||
"components": "<rootDir>/src/components", | ||
"utils": "<rootDir>/src/utils", | ||
"constants": "<rootDir>/src/constants", | ||
"containers": "<rootDir>/src/containers", | ||
"reducers": "<rootDir>/src/reducers", | ||
"routing": "<rootDir>/src/routing", | ||
"actions": "<rootDir>/src/actions", | ||
"sagas": "<rootDir>/src/sagas", | ||
"widget": "<rootDir>/widget", | ||
"mock-data": "<rootDir>/tests/__mocks__/mockData.js", | ||
@@ -106,0 +103,0 @@ "^.+\\.(scss|css|svg|png)$": "identity-obj-proxy", |
@@ -18,3 +18,3 @@ [![NPM Version](https://img.shields.io/badge/npm-1.3.8-red.svg)](https://www.npmjs.com/package/filestack-react) | ||
Install ``filestack-react`` and ``filestack-js`` through npm | ||
Install ``filestack-react`` and ``filestack-js`` through npm. | ||
@@ -24,9 +24,6 @@ ```shell | ||
``` | ||
or | ||
```shell | ||
yarn add filestack-react filestack-js | ||
``` | ||
## Import | ||
```javascript | ||
var ReactFilestack = require('filestack-react'); | ||
const ReactFilestack = require('filestack-react'); | ||
``` | ||
@@ -45,3 +42,3 @@ In ES2015 | ||
## Usage | ||
You should register [Filestack](https://www.filestack.com) website and get an **API key** first! | ||
You should register on the [Filestack](https://www.filestack.com) website and get an **API key** first! | ||
@@ -86,8 +83,8 @@ **1. Custom Designed button** | ||
Available modes: | ||
* [upload](https://www.filestack.com/docs/javascript-api/upload-v3) | ||
* [transform](https://www.filestack.com/docs/javascript-api/transform-v3) | ||
* [retrieve](https://www.filestack.com/docs/javascript-api/retrieve-v3) | ||
* [storeUrl](https://www.filestack.com/docs/javascript-api/store-url-v3) | ||
* [metadata](https://www.filestack.com/docs/javascript-api/metadata-v3) | ||
* [remove](https://www.filestack.com/docs/javascript-api/remove-v3) | ||
* [upload](https://filestack.github.io/filestack-js/classes/client.html#upload) | ||
* [transform](https://filestack.github.io/filestack-js/classes/client.html#transform) | ||
* [retrieve](https://filestack.github.io/filestack-js/classes/client.html#retrieve) | ||
* [storeUrl](https://filestack.github.io/filestack-js/classes/client.html#storeurl) | ||
* [metadata](https://filestack.github.io/filestack-js/classes/client.html#metadata) | ||
* [remove](https://filestack.github.io/filestack-js/classes/client.html#remove) | ||
@@ -123,10 +120,10 @@ Define your own options object and callback function, connect them to the component and get the result from Filestack: | ||
**Filestack-js client** | ||
**filestack-js client** | ||
You can also import the official client and decouple its React component ReactFilestack. | ||
However, you will need to initialize it with the API key and optional security options. | ||
However, you will need to initialize it with the API key and any [client options](https://filestack.github.io/filestack-js/interfaces/clientoptions.html) you need such as security, cname, and sessionCache. | ||
```javascript | ||
import { client } from 'filestack-react'; | ||
const filestack = client.init('YOUR_API_KEY', security); | ||
const filestack = client.init('YOUR_API_KEY', options); | ||
``` | ||
@@ -141,3 +138,3 @@ | ||
```javascript | ||
yarn start | ||
npm start | ||
``` | ||
@@ -153,3 +150,3 @@ | ||
## Available Props | ||
[Official Filestack Documentation](https://filestack.com/docs) | ||
Please also see the [Official JavaScript API reference](https://filestack.github.io/filestack-js) | ||
@@ -172,5 +169,3 @@ > ### apikey | ||
> ### options | ||
> **optional** object. Detailed options to customize the mode behavior. | ||
> | ||
> See Javascript API from the[official documentation](https://filestack.com/docs). | ||
> **optional** object. Detailed options to customize the specific mode behavior. For example, for `pick` mode the [following options](https://filestack.github.io/filestack-js/interfaces/pickeroptions.html) are supported. | ||
@@ -190,2 +185,5 @@ > ### security | ||
> ### sessionCache | ||
> **optional** If true then remember users (up to session expiry) when using the Filestack Cloud API. By default users need to authenticate on every pick. | ||
## Versioning | ||
@@ -192,0 +190,0 @@ Filestack React follows the [Semantic Versioning](http://semver.org/). |
@@ -0,5 +1,5 @@ | ||
import * as client from 'filestack-js'; | ||
import ReactFilestack from './ReactFilestack'; | ||
import client from 'filestack-js'; | ||
export default ReactFilestack; | ||
export { client }; |
import React, { Component } from 'react'; | ||
import filestack from 'filestack-js'; | ||
import * as filestack from 'filestack-js'; | ||
import PropTypes from 'prop-types'; | ||
@@ -19,2 +19,3 @@ | ||
cname: null, | ||
sessionCache: false, | ||
}; | ||
@@ -36,2 +37,3 @@ | ||
cname: PropTypes.string, | ||
sessionCache: PropTypes.bool, | ||
}; | ||
@@ -50,4 +52,6 @@ | ||
security, | ||
cname | ||
cname, | ||
sessionCache, | ||
} = this.props; | ||
const onFinished = (result) => { | ||
@@ -68,3 +72,3 @@ if (typeof onSuccess === 'function') { | ||
this.initClient(mode, apikey, options, file, security, cname) | ||
this.initClient(mode, apikey, options, file, security, cname, sessionCache) | ||
.then(onFinished) | ||
@@ -74,7 +78,11 @@ .catch(onFail); | ||
initClient = (mode, apikey, options, file, security, cname) => { | ||
initClient = (mode, apikey, options, file, security, cname, sessionCache) => { | ||
const { url, handle } = options; | ||
delete options.handle; | ||
delete options.url; | ||
const client = filestack.init(apikey, security, cname); | ||
const client = filestack.init(apikey, { | ||
security, | ||
cname, | ||
sessionCache, | ||
}); | ||
@@ -84,3 +92,3 @@ if (mode === 'transform') { | ||
try { | ||
resolve(client.transform(url, options)); | ||
resolve(client.transform(handle, options)); | ||
} catch (err) { | ||
@@ -102,3 +110,5 @@ reject(err); | ||
return client.pick(options); | ||
return new Promise((resolve) => { | ||
client.picker({ ...options, onUploadDone: resolve }).open(); | ||
}); | ||
}; | ||
@@ -105,0 +115,0 @@ |
@@ -1,3 +0,3 @@ | ||
{"/Users/Sam/Documents/projects/filestack-react/setup-jasmine-env.js": {"path":"/Users/Sam/Documents/projects/filestack-react/setup-jasmine-env.js","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":23}},"1":{"start":{"line":3,"column":16},"end":{"line":3,"column":44}},"2":{"start":{"line":4,"column":20},"end":{"line":7,"column":2}},"3":{"start":{"line":8,"column":0},"end":{"line":8,"column":44}}},"fnMap":{},"branchMap":{},"s":{"0":1,"1":1,"2":1,"3":1},"f":{},"b":{},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"f130347da427379ef1eefb56cbdb6788038eeca4"} | ||
,"/Users/Sam/Documents/projects/filestack-react/src/ReactFilestack.jsx": {"path":"/Users/Sam/Documents/projects/filestack-react/src/ReactFilestack.jsx","statementMap":{"0":{"start":{"line":11,"column":25},"end":{"line":11,"column":44}},"1":{"start":{"line":12,"column":22},"end":{"line":12,"column":42}},"2":{"start":{"line":38,"column":4},"end":{"line":38,"column":28}},"3":{"start":{"line":39,"column":4},"end":{"line":39,"column":27}},"4":{"start":{"line":49,"column":8},"end":{"line":49,"column":18}},"5":{"start":{"line":50,"column":23},"end":{"line":56,"column":5}},"6":{"start":{"line":51,"column":6},"end":{"line":55,"column":7}},"7":{"start":{"line":52,"column":8},"end":{"line":52,"column":26}},"8":{"start":{"line":54,"column":8},"end":{"line":54,"column":28}},"9":{"start":{"line":57,"column":19},"end":{"line":63,"column":5}},"10":{"start":{"line":58,"column":6},"end":{"line":62,"column":7}},"11":{"start":{"line":59,"column":8},"end":{"line":59,"column":23}},"12":{"start":{"line":61,"column":8},"end":{"line":61,"column":29}},"13":{"start":{"line":65,"column":4},"end":{"line":67,"column":21}},"14":{"start":{"line":71,"column":28},"end":{"line":71,"column":35}},"15":{"start":{"line":72,"column":4},"end":{"line":72,"column":26}},"16":{"start":{"line":73,"column":4},"end":{"line":73,"column":23}},"17":{"start":{"line":74,"column":19},"end":{"line":74,"column":58}},"18":{"start":{"line":76,"column":4},"end":{"line":94,"column":5}},"19":{"start":{"line":77,"column":6},"end":{"line":83,"column":9}},"20":{"start":{"line":78,"column":8},"end":{"line":82,"column":9}},"21":{"start":{"line":79,"column":10},"end":{"line":79,"column":50}},"22":{"start":{"line":81,"column":10},"end":{"line":81,"column":22}},"23":{"start":{"line":84,"column":11},"end":{"line":94,"column":5}},"24":{"start":{"line":85,"column":6},"end":{"line":85,"column":46}},"25":{"start":{"line":86,"column":11},"end":{"line":94,"column":5}},"26":{"start":{"line":87,"column":6},"end":{"line":87,"column":46}},"27":{"start":{"line":88,"column":11},"end":{"line":94,"column":5}},"28":{"start":{"line":89,"column":6},"end":{"line":89,"column":43}},"29":{"start":{"line":90,"column":11},"end":{"line":94,"column":5}},"30":{"start":{"line":91,"column":6},"end":{"line":91,"column":42}},"31":{"start":{"line":92,"column":11},"end":{"line":94,"column":5}},"32":{"start":{"line":93,"column":6},"end":{"line":93,"column":45}},"33":{"start":{"line":96,"column":4},"end":{"line":96,"column":32}},"34":{"start":{"line":100,"column":78},"end":{"line":100,"column":88}},"35":{"start":{"line":101,"column":4},"end":{"line":105,"column":5}},"36":{"start":{"line":102,"column":6},"end":{"line":104,"column":8}},"37":{"start":{"line":106,"column":16},"end":{"line":106,"column":37}},"38":{"start":{"line":107,"column":4},"end":{"line":115,"column":6}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":11,"column":15},"end":{"line":11,"column":16}},"loc":{"start":{"line":11,"column":25},"end":{"line":11,"column":44}},"line":11},"1":{"name":"(anonymous_1)","decl":{"start":{"line":12,"column":13},"end":{"line":12,"column":14}},"loc":{"start":{"line":12,"column":22},"end":{"line":12,"column":42}},"line":12},"2":{"name":"(anonymous_2)","decl":{"start":{"line":37,"column":16},"end":{"line":37,"column":17}},"loc":{"start":{"line":37,"column":27},"end":{"line":68,"column":3}},"line":37},"3":{"name":"(anonymous_3)","decl":{"start":{"line":50,"column":23},"end":{"line":50,"column":24}},"loc":{"start":{"line":50,"column":35},"end":{"line":56,"column":5}},"line":50},"4":{"name":"(anonymous_4)","decl":{"start":{"line":57,"column":19},"end":{"line":57,"column":20}},"loc":{"start":{"line":57,"column":30},"end":{"line":63,"column":5}},"line":57},"5":{"name":"(anonymous_5)","decl":{"start":{"line":70,"column":15},"end":{"line":70,"column":16}},"loc":{"start":{"line":70,"column":65},"end":{"line":97,"column":3}},"line":70},"6":{"name":"(anonymous_6)","decl":{"start":{"line":77,"column":25},"end":{"line":77,"column":26}},"loc":{"start":{"line":77,"column":46},"end":{"line":83,"column":7}},"line":77},"7":{"name":"(anonymous_7)","decl":{"start":{"line":99,"column":2},"end":{"line":99,"column":3}},"loc":{"start":{"line":99,"column":12},"end":{"line":116,"column":3}},"line":99}},"branchMap":{"0":{"loc":{"start":{"line":51,"column":6},"end":{"line":55,"column":7}},"type":"if","locations":[{"start":{"line":51,"column":6},"end":{"line":55,"column":7}},{"start":{"line":51,"column":6},"end":{"line":55,"column":7}}],"line":51},"1":{"loc":{"start":{"line":58,"column":6},"end":{"line":62,"column":7}},"type":"if","locations":[{"start":{"line":58,"column":6},"end":{"line":62,"column":7}},{"start":{"line":58,"column":6},"end":{"line":62,"column":7}}],"line":58},"2":{"loc":{"start":{"line":76,"column":4},"end":{"line":94,"column":5}},"type":"if","locations":[{"start":{"line":76,"column":4},"end":{"line":94,"column":5}},{"start":{"line":76,"column":4},"end":{"line":94,"column":5}}],"line":76},"3":{"loc":{"start":{"line":84,"column":11},"end":{"line":94,"column":5}},"type":"if","locations":[{"start":{"line":84,"column":11},"end":{"line":94,"column":5}},{"start":{"line":84,"column":11},"end":{"line":94,"column":5}}],"line":84},"4":{"loc":{"start":{"line":86,"column":11},"end":{"line":94,"column":5}},"type":"if","locations":[{"start":{"line":86,"column":11},"end":{"line":94,"column":5}},{"start":{"line":86,"column":11},"end":{"line":94,"column":5}}],"line":86},"5":{"loc":{"start":{"line":88,"column":11},"end":{"line":94,"column":5}},"type":"if","locations":[{"start":{"line":88,"column":11},"end":{"line":94,"column":5}},{"start":{"line":88,"column":11},"end":{"line":94,"column":5}}],"line":88},"6":{"loc":{"start":{"line":90,"column":11},"end":{"line":94,"column":5}},"type":"if","locations":[{"start":{"line":90,"column":11},"end":{"line":94,"column":5}},{"start":{"line":90,"column":11},"end":{"line":94,"column":5}}],"line":90},"7":{"loc":{"start":{"line":92,"column":11},"end":{"line":94,"column":5}},"type":"if","locations":[{"start":{"line":92,"column":11},"end":{"line":94,"column":5}},{"start":{"line":92,"column":11},"end":{"line":94,"column":5}}],"line":92},"8":{"loc":{"start":{"line":101,"column":4},"end":{"line":105,"column":5}},"type":"if","locations":[{"start":{"line":101,"column":4},"end":{"line":105,"column":5}},{"start":{"line":101,"column":4},"end":{"line":105,"column":5}}],"line":101},"9":{"loc":{"start":{"line":106,"column":16},"end":{"line":106,"column":37}},"type":"cond-expr","locations":[{"start":{"line":106,"column":23},"end":{"line":106,"column":26}},{"start":{"line":106,"column":29},"end":{"line":106,"column":37}}],"line":106},"10":{"loc":{"start":{"line":113,"column":9},"end":{"line":113,"column":31}},"type":"binary-expr","locations":[{"start":{"line":113,"column":9},"end":{"line":113,"column":17}},{"start":{"line":113,"column":21},"end":{"line":113,"column":31}}],"line":113}},"s":{"0":7,"1":2,"2":11,"3":11,"4":11,"5":11,"6":8,"7":7,"8":1,"9":11,"10":3,"11":2,"12":1,"13":11,"14":11,"15":11,"16":11,"17":11,"18":11,"19":2,"20":2,"21":2,"22":1,"23":9,"24":1,"25":8,"26":1,"27":7,"28":1,"29":6,"30":2,"31":4,"32":1,"33":3,"34":24,"35":24,"36":1,"37":23,"38":23},"f":{"0":7,"1":2,"2":11,"3":8,"4":3,"5":11,"6":2,"7":24},"b":{"0":[7,1],"1":[2,1],"2":[2,9],"3":[1,8],"4":[1,7],"5":[1,6],"6":[2,4],"7":[1,3],"8":[1,23],"9":[0,23],"10":[23,23]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"2889a952dcf74c07f5ebba0e9f7589d2d6e19030"} | ||
{"/home/josh/Filestack/filestack-react/src/ReactFilestack.jsx": {"path":"/home/josh/Filestack/filestack-react/src/ReactFilestack.jsx","statementMap":{"0":{"start":{"line":11,"column":25},"end":{"line":11,"column":44}},"1":{"start":{"line":12,"column":22},"end":{"line":12,"column":42}},"2":{"start":{"line":40,"column":4},"end":{"line":40,"column":28}},"3":{"start":{"line":41,"column":4},"end":{"line":41,"column":27}},"4":{"start":{"line":52,"column":8},"end":{"line":52,"column":18}},"5":{"start":{"line":54,"column":23},"end":{"line":60,"column":5}},"6":{"start":{"line":55,"column":6},"end":{"line":59,"column":7}},"7":{"start":{"line":56,"column":8},"end":{"line":56,"column":26}},"8":{"start":{"line":58,"column":8},"end":{"line":58,"column":28}},"9":{"start":{"line":61,"column":19},"end":{"line":67,"column":5}},"10":{"start":{"line":62,"column":6},"end":{"line":66,"column":7}},"11":{"start":{"line":63,"column":8},"end":{"line":63,"column":23}},"12":{"start":{"line":65,"column":8},"end":{"line":65,"column":29}},"13":{"start":{"line":69,"column":4},"end":{"line":71,"column":21}},"14":{"start":{"line":75,"column":28},"end":{"line":75,"column":35}},"15":{"start":{"line":76,"column":4},"end":{"line":76,"column":26}},"16":{"start":{"line":77,"column":4},"end":{"line":77,"column":23}},"17":{"start":{"line":78,"column":19},"end":{"line":82,"column":6}},"18":{"start":{"line":84,"column":4},"end":{"line":103,"column":5}},"19":{"start":{"line":85,"column":6},"end":{"line":92,"column":9}},"20":{"start":{"line":86,"column":8},"end":{"line":91,"column":9}},"21":{"start":{"line":87,"column":10},"end":{"line":87,"column":53}},"22":{"start":{"line":89,"column":10},"end":{"line":89,"column":27}},"23":{"start":{"line":90,"column":10},"end":{"line":90,"column":22}},"24":{"start":{"line":93,"column":11},"end":{"line":103,"column":5}},"25":{"start":{"line":94,"column":6},"end":{"line":94,"column":46}},"26":{"start":{"line":95,"column":11},"end":{"line":103,"column":5}},"27":{"start":{"line":96,"column":6},"end":{"line":96,"column":46}},"28":{"start":{"line":97,"column":11},"end":{"line":103,"column":5}},"29":{"start":{"line":98,"column":6},"end":{"line":98,"column":43}},"30":{"start":{"line":99,"column":11},"end":{"line":103,"column":5}},"31":{"start":{"line":100,"column":6},"end":{"line":100,"column":42}},"32":{"start":{"line":101,"column":11},"end":{"line":103,"column":5}},"33":{"start":{"line":102,"column":6},"end":{"line":102,"column":45}},"34":{"start":{"line":105,"column":4},"end":{"line":107,"column":7}},"35":{"start":{"line":106,"column":6},"end":{"line":106,"column":66}},"36":{"start":{"line":111,"column":78},"end":{"line":111,"column":88}},"37":{"start":{"line":112,"column":4},"end":{"line":116,"column":5}},"38":{"start":{"line":113,"column":6},"end":{"line":115,"column":8}},"39":{"start":{"line":117,"column":16},"end":{"line":117,"column":37}},"40":{"start":{"line":118,"column":4},"end":{"line":126,"column":6}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":11,"column":15},"end":{"line":11,"column":16}},"loc":{"start":{"line":11,"column":25},"end":{"line":11,"column":44}},"line":11},"1":{"name":"(anonymous_1)","decl":{"start":{"line":12,"column":13},"end":{"line":12,"column":14}},"loc":{"start":{"line":12,"column":22},"end":{"line":12,"column":42}},"line":12},"2":{"name":"(anonymous_2)","decl":{"start":{"line":39,"column":16},"end":{"line":39,"column":17}},"loc":{"start":{"line":39,"column":27},"end":{"line":72,"column":3}},"line":39},"3":{"name":"(anonymous_3)","decl":{"start":{"line":54,"column":23},"end":{"line":54,"column":24}},"loc":{"start":{"line":54,"column":35},"end":{"line":60,"column":5}},"line":54},"4":{"name":"(anonymous_4)","decl":{"start":{"line":61,"column":19},"end":{"line":61,"column":20}},"loc":{"start":{"line":61,"column":30},"end":{"line":67,"column":5}},"line":61},"5":{"name":"(anonymous_5)","decl":{"start":{"line":74,"column":15},"end":{"line":74,"column":16}},"loc":{"start":{"line":74,"column":79},"end":{"line":108,"column":3}},"line":74},"6":{"name":"(anonymous_6)","decl":{"start":{"line":85,"column":25},"end":{"line":85,"column":26}},"loc":{"start":{"line":85,"column":46},"end":{"line":92,"column":7}},"line":85},"7":{"name":"(anonymous_7)","decl":{"start":{"line":105,"column":23},"end":{"line":105,"column":24}},"loc":{"start":{"line":105,"column":36},"end":{"line":107,"column":5}},"line":105},"8":{"name":"(anonymous_8)","decl":{"start":{"line":110,"column":2},"end":{"line":110,"column":3}},"loc":{"start":{"line":110,"column":12},"end":{"line":127,"column":3}},"line":110}},"branchMap":{"0":{"loc":{"start":{"line":55,"column":6},"end":{"line":59,"column":7}},"type":"if","locations":[{"start":{"line":55,"column":6},"end":{"line":59,"column":7}},{"start":{"line":55,"column":6},"end":{"line":59,"column":7}}],"line":55},"1":{"loc":{"start":{"line":62,"column":6},"end":{"line":66,"column":7}},"type":"if","locations":[{"start":{"line":62,"column":6},"end":{"line":66,"column":7}},{"start":{"line":62,"column":6},"end":{"line":66,"column":7}}],"line":62},"2":{"loc":{"start":{"line":84,"column":4},"end":{"line":103,"column":5}},"type":"if","locations":[{"start":{"line":84,"column":4},"end":{"line":103,"column":5}},{"start":{"line":84,"column":4},"end":{"line":103,"column":5}}],"line":84},"3":{"loc":{"start":{"line":93,"column":11},"end":{"line":103,"column":5}},"type":"if","locations":[{"start":{"line":93,"column":11},"end":{"line":103,"column":5}},{"start":{"line":93,"column":11},"end":{"line":103,"column":5}}],"line":93},"4":{"loc":{"start":{"line":95,"column":11},"end":{"line":103,"column":5}},"type":"if","locations":[{"start":{"line":95,"column":11},"end":{"line":103,"column":5}},{"start":{"line":95,"column":11},"end":{"line":103,"column":5}}],"line":95},"5":{"loc":{"start":{"line":97,"column":11},"end":{"line":103,"column":5}},"type":"if","locations":[{"start":{"line":97,"column":11},"end":{"line":103,"column":5}},{"start":{"line":97,"column":11},"end":{"line":103,"column":5}}],"line":97},"6":{"loc":{"start":{"line":99,"column":11},"end":{"line":103,"column":5}},"type":"if","locations":[{"start":{"line":99,"column":11},"end":{"line":103,"column":5}},{"start":{"line":99,"column":11},"end":{"line":103,"column":5}}],"line":99},"7":{"loc":{"start":{"line":101,"column":11},"end":{"line":103,"column":5}},"type":"if","locations":[{"start":{"line":101,"column":11},"end":{"line":103,"column":5}},{"start":{"line":101,"column":11},"end":{"line":103,"column":5}}],"line":101},"8":{"loc":{"start":{"line":112,"column":4},"end":{"line":116,"column":5}},"type":"if","locations":[{"start":{"line":112,"column":4},"end":{"line":116,"column":5}},{"start":{"line":112,"column":4},"end":{"line":116,"column":5}}],"line":112},"9":{"loc":{"start":{"line":117,"column":16},"end":{"line":117,"column":37}},"type":"cond-expr","locations":[{"start":{"line":117,"column":23},"end":{"line":117,"column":26}},{"start":{"line":117,"column":29},"end":{"line":117,"column":37}}],"line":117},"10":{"loc":{"start":{"line":124,"column":9},"end":{"line":124,"column":31}},"type":"binary-expr","locations":[{"start":{"line":124,"column":9},"end":{"line":124,"column":17}},{"start":{"line":124,"column":21},"end":{"line":124,"column":31}}],"line":124}},"s":{"0":6,"1":1,"2":9,"3":9,"4":9,"5":9,"6":6,"7":6,"8":0,"9":9,"10":1,"11":1,"12":0,"13":9,"14":9,"15":9,"16":9,"17":9,"18":9,"19":2,"20":2,"21":2,"22":1,"23":1,"24":7,"25":1,"26":6,"27":1,"28":5,"29":1,"30":4,"31":1,"32":3,"33":1,"34":2,"35":2,"36":20,"37":20,"38":1,"39":19,"40":19},"f":{"0":6,"1":1,"2":9,"3":6,"4":1,"5":9,"6":2,"7":2,"8":20},"b":{"0":[6,0],"1":[1,0],"2":[2,7],"3":[1,6],"4":[1,5],"5":[1,4],"6":[1,3],"7":[1,2],"8":[1,19],"9":[0,19],"10":[19,19]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"a5b9df0f2faf318d9a97faf77ad5717c286e6f7d"} | ||
,"/home/josh/Filestack/filestack-react/src/index.js": {"path":"/home/josh/Filestack/filestack-react/src/index.js","statementMap":{},"fnMap":{},"branchMap":{},"s":{},"f":{},"b":{},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"caec4a4ff2d0017e4b5108f212ee46725c416281"} | ||
} |
@@ -19,3 +19,4 @@ const mockPickResult = [ | ||
]; | ||
const mockMetadaResult = { | ||
const mockMetadataResult = { | ||
mimetype: "image/jpeg", | ||
@@ -31,2 +32,3 @@ uploaded: 1432816978028.804, | ||
}; | ||
const mockStoreUrlResult = { | ||
@@ -41,2 +43,3 @@ container: "filestack-website-uploads", | ||
}; | ||
const mockRetrieveResult = { | ||
@@ -53,3 +56,5 @@ mimetype: "text/html", | ||
}; | ||
const mockTransformResult = 'https://process.filestackapi.com/A1nL8omiAR8W7pHi3cotzz/crop=dim:[600,900,600,600]/vignette=amount:50,blurmode:gaussian/https://d1wtqaffaaj63z.cloudfront.net/images/NY_199_E_of_Hammertown_2014.jpg'; | ||
const mockUploadResult = { | ||
@@ -66,48 +71,44 @@ handle: "KL0OM5j9SGuebGJvYC2V", | ||
const filestack = { | ||
init: (apikey, security) => { | ||
return { | ||
pick: (options) => { | ||
return new Promise((resolve, reject) => { | ||
if(options.wrong) { | ||
export const init = () => { | ||
return { | ||
picker: (options) => { | ||
return { | ||
open: () => new Promise((resolve) => { | ||
if (options.wrong) { | ||
reject('wrong options property'); | ||
} | ||
resolve(mockPickResult); | ||
}); | ||
}, | ||
metadata: (handle, options) => { | ||
return new Promise((resolve, reject) => { | ||
resolve(mockMetadaResult); | ||
}); | ||
}, | ||
remove: (handle, security) => { | ||
return new Promise((resolve, reject) => { | ||
resolve('removed'); | ||
}); | ||
}, | ||
storeURL: (url, options) => { | ||
return new Promise((resolve, reject) => { | ||
resolve(mockStoreUrlResult); | ||
}); | ||
}, | ||
retrieve: (handle, options) => { | ||
return new Promise((resolve, reject) => { | ||
resolve(mockRetrieveResult); | ||
}); | ||
}, | ||
transform: (url, options) => { | ||
if (options.wrong) throw 'Error'; | ||
return mockTransformResult; | ||
}, | ||
upload: (file, options) => { | ||
return new Promise((resolve, reject) => { | ||
resolve(mockUploadResult); | ||
}); | ||
}, | ||
}; | ||
}, | ||
}), | ||
}; | ||
}, | ||
metadata: () => { | ||
return new Promise((resolve) => { | ||
resolve(mockMetadataResult); | ||
}); | ||
}, | ||
remove: () => { | ||
return new Promise((resolve) => { | ||
resolve('removed'); | ||
}); | ||
}, | ||
storeURL: () => { | ||
return new Promise((resolve) => { | ||
resolve(mockStoreUrlResult); | ||
}); | ||
}, | ||
retrieve: (handle) => { | ||
return new Promise((resolve) => { | ||
resolve(mockRetrieveResult); | ||
}); | ||
}, | ||
transform: (url, options) => { | ||
if (options.wrong) throw new Error('Error'); | ||
return mockTransformResult; | ||
}, | ||
upload: () => { | ||
return new Promise((resolve) => { | ||
resolve(mockUploadResult); | ||
}); | ||
}, | ||
}; | ||
}; | ||
export default filestack; |
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import { configure, shallow } from 'enzyme'; | ||
import { shallowToJson } from 'enzyme-to-json'; | ||
import ReactFilestack from '../../src/ReactFilestack'; | ||
const test = () => <div>test</div>; | ||
configure({ adapter: new Adapter() }); | ||
const test = () => <div>test</div>; // eslint-disable-line | ||
const apikey = 'Acu94EFL1STGYvkM6a8usz'; | ||
const toggleDialog = jest.fn(); | ||
const getInvoices = jest.fn(); | ||
describe('<ReactFilestack />', () => { | ||
@@ -17,3 +17,3 @@ let wrapper; | ||
wrapper = shallow( | ||
<ReactFilestack apikey={apikey} /> | ||
<ReactFilestack apikey={apikey} />, | ||
); | ||
@@ -35,4 +35,4 @@ }); | ||
}, | ||
render: test | ||
} | ||
render: test, | ||
}, | ||
); | ||
@@ -58,3 +58,3 @@ expect(shallowToJson(wrapper)).toMatchSnapshot(); | ||
mode: 'metadata', | ||
options: { handle: 'handle' } | ||
options: { handle: 'handle' }, | ||
}); | ||
@@ -69,3 +69,3 @@ wrapper.find('button').simulate('click', { stopPropagation () {}, preventDefault() {} }); | ||
options: { handle: 'handle' }, | ||
security: { policy: 'policy', signature: 'signature' } | ||
security: { policy: 'policy', signature: 'signature' }, | ||
}); | ||
@@ -79,3 +79,3 @@ wrapper.find('button').simulate('click', { stopPropagation () {}, preventDefault() {} }); | ||
mode: 'storeUrl', | ||
options: { url: 'url' } | ||
options: { url: 'url' }, | ||
}); | ||
@@ -89,3 +89,3 @@ wrapper.find('button').simulate('click', { stopPropagation () {}, preventDefault() {} }); | ||
mode: 'retrieve', | ||
options: { handle: 'handle' } | ||
options: { handle: 'handle' }, | ||
}); | ||
@@ -99,3 +99,3 @@ wrapper.find('button').simulate('click', { stopPropagation () {}, preventDefault() {} }); | ||
mode: 'transform', | ||
options: { url: 'url' } | ||
options: { url: 'url' }, | ||
}); | ||
@@ -109,3 +109,3 @@ wrapper.find('button').simulate('click', { stopPropagation () {}, preventDefault() {} }); | ||
mode: 'transform', | ||
options: { url: 'url', wrong: 'wrong' }, | ||
options: { handle: 'abc123', wrong: 'wrong' }, | ||
}); | ||
@@ -120,3 +120,3 @@ wrapper.find('button').simulate('click', { stopPropagation () {}, preventDefault() {} }); | ||
options: { url: 'url' }, | ||
file: new Blob([JSON.stringify({ hello: "world" }, null, 2)], { type : 'application/json' }), | ||
file: new Blob([JSON.stringify({ hello: 'world' }, null, 2)], { type: 'application/json' }), | ||
}); | ||
@@ -126,28 +126,2 @@ wrapper.find('button').simulate('click', { stopPropagation () {}, preventDefault() {} }); | ||
}); | ||
it('should not accept onSuccess prop different than function type', () => { | ||
wrapper.setProps({ | ||
mode: 'upload', | ||
options: { url: 'url' }, | ||
file: new Blob([JSON.stringify({ hello: "world" }, null, 2)], { type : 'application/json' }), | ||
onSuccess: {}, | ||
}); | ||
wrapper.find('button').simulate('click', { stopPropagation () {}, preventDefault() {} }); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
it('should not accept onError prop different than function type', () => { | ||
wrapper.setProps({ | ||
mode: 'pick', | ||
options: { url: 'url', wrong: 'wrong' }, | ||
onError: {}, | ||
}); | ||
wrapper.find('button').simulate('click', { stopPropagation () {}, preventDefault() {} }); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
32
1292
6
0
332197
50
192