@sb1/ffe-file-upload-react 5.0.4 → 5.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/FileUpload.js CHANGED
@@ -1,18 +1,18 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
 
3
3
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
4
 
5
5
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
6
6
 
7
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
8
 
9
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
9
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
10
 
11
11
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
12
 
13
13
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
14
 
15
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
15
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
16
16
 
17
17
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
18
18
 
package/lib/FileUpload.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
@@ -21,15 +21,15 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
21
21
 
22
22
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
23
23
 
24
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
24
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
25
25
 
26
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
26
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
27
27
 
28
28
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
29
29
 
30
30
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
31
31
 
32
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
32
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
33
33
 
34
34
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
35
35
 
package/lib/index.js CHANGED
@@ -3,13 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.default = void 0;
6
7
  Object.defineProperty(exports, "getFileContent", {
7
8
  enumerable: true,
8
9
  get: function get() {
9
10
  return _fileContent.getFileContent;
10
11
  }
11
12
  });
12
- exports.default = void 0;
13
13
 
14
14
  var _FileUpload = _interopRequireDefault(require("./FileUpload"));
15
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-file-upload-react",
3
- "version": "5.0.4",
3
+ "version": "5.0.8",
4
4
  "description": "Upload file button with validation and list of uploaded files.",
5
5
  "keywords": [
6
6
  "ffe"
@@ -19,10 +19,9 @@
19
19
  "url": "ssh://git@github.com:SpareBank1/designsystem.git"
20
20
  },
21
21
  "scripts": {
22
- "build": "npm run build:cjs && npm run build:es",
23
- "build:cjs": "babel -d lib/. --root-mode=upward --env-name=cjs --ignore=*.spec.js src/.",
24
- "build:es": "babel -d es/. --root-mode=upward --env-name=es --ignore=*.spec.js src/.",
25
- "lint": "eslint src/.",
22
+ "build": "ffe-buildtool babel --no-copy-typedef",
23
+ "watch": "ffe-buildtool babel-watch",
24
+ "lint": "eslint src",
26
25
  "test": "jest",
27
26
  "test:watch": "jest --watch"
28
27
  },
@@ -30,9 +29,10 @@
30
29
  "setupTestFrameworkScriptFile": "../../test-setup.js"
31
30
  },
32
31
  "dependencies": {
33
- "classnames": "^2.2.5"
32
+ "classnames": "^2.3.1"
34
33
  },
35
34
  "devDependencies": {
35
+ "@sb1/ffe-buildtool": "^0.3.1",
36
36
  "enzyme": "^3.7.0",
37
37
  "enzyme-adapter-react-16": "^1.7.0",
38
38
  "jest": "^26.0.0",
@@ -50,5 +50,5 @@
50
50
  "depencencies": {
51
51
  "prop-types": "^15.6.0"
52
52
  },
53
- "gitHead": "274d896b03703139da2bfeab8ab32652f6b4c1e2"
53
+ "gitHead": "d50bd2b6e03fe28b26c658d2630ed862d1484f08"
54
54
  }
package/CHANGELOG.md DELETED
@@ -1,290 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [5.0.4](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@5.0.3...@sb1/ffe-file-upload-react@5.0.4) (2021-03-15)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * **ffe-file-upload-react:** broadens version of peer dependencies ([627577b](https://github.com/SpareBank1/designsystem/commit/627577b9a8fa4850f025d7d42e5d77be5af73626))
12
-
13
-
14
-
15
-
16
-
17
- ## [5.0.3](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@5.0.2...@sb1/ffe-file-upload-react@5.0.3) (2021-02-02)
18
-
19
-
20
- ### Bug Fixes
21
-
22
- * packages/ffe-file-upload-react/package.json to reduce vulnerabilities ([ac3ee52](https://github.com/SpareBank1/designsystem/commit/ac3ee52514b4a65093f09a38e9a40f3d1799b180))
23
-
24
-
25
-
26
-
27
-
28
- ## [5.0.2](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@5.0.1...@sb1/ffe-file-upload-react@5.0.2) (2021-02-02)
29
-
30
-
31
- ### Bug Fixes
32
-
33
- * **ffe-file-upload-react:** reduce vulnerabilities ([9af58e1](https://github.com/SpareBank1/designsystem/commit/9af58e1b015455647460f2f22e4b51ca6ca680ce))
34
-
35
-
36
-
37
-
38
-
39
- ## [5.0.1](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@5.0.0...@sb1/ffe-file-upload-react@5.0.1) (2019-10-16)
40
-
41
- **Note:** Version bump only for package @sb1/ffe-file-upload-react
42
-
43
- # [5.0.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@4.0.0...@sb1/ffe-file-upload-react@5.0.0) (2019-09-16)
44
-
45
- ### Code Refactoring
46
-
47
- - **ffe-file-upload-react:** Refactor with new design ([30400f2](https://github.com/SpareBank1/designsystem/commit/30400f2))
48
-
49
- ### BREAKING CHANGES
50
-
51
- - **ffe-file-upload-react:** Redesign of module with new design, including drag and drop support
52
-
53
- # [4.0.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.11...@sb1/ffe-file-upload-react@4.0.0) (2019-08-27)
54
-
55
- ### chore
56
-
57
- - bump React to 16.9 to allow for using hooks etc ([e3901f1](https://github.com/SpareBank1/designsystem/commit/e3901f1))
58
-
59
- ### BREAKING CHANGES
60
-
61
- - peerDep of React is raised to 16.9. While this in itself
62
- isn't a breaking change, it allows for the use of hooks in later releases.
63
- Such changes would just be a minor version, or even a patch, but without
64
- this major version bump it would result in a runtime error for consumers.
65
-
66
- ## [3.0.11](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.10...@sb1/ffe-file-upload-react@3.0.11) (2019-06-26)
67
-
68
- **Note:** Version bump only for package @sb1/ffe-file-upload-react
69
-
70
- ## [3.0.10](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.9...@sb1/ffe-file-upload-react@3.0.10) (2019-05-21)
71
-
72
- ### Bug Fixes
73
-
74
- - **ffe-file-upload-react:** ffe-form compat ([ece3fd3](https://github.com/SpareBank1/designsystem/commit/ece3fd3))
75
-
76
- ## [3.0.9](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.8...@sb1/ffe-file-upload-react@3.0.9) (2018-12-11)
77
-
78
- ### Bug Fixes
79
-
80
- - Build tree shakeable packages ([fb4a9ea](https://github.com/SpareBank1/designsystem/commit/fb4a9ea))
81
-
82
- ## [3.0.8](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.7...@sb1/ffe-file-upload-react@3.0.8) (2018-11-26)
83
-
84
- **Note:** Version bump only for package @sb1/ffe-file-upload-react
85
-
86
- ## [3.0.7](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.6...@sb1/ffe-file-upload-react@3.0.7) (2018-11-09)
87
-
88
- **Note:** Version bump only for package @sb1/ffe-file-upload-react
89
-
90
- ## [3.0.6](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.5...@sb1/ffe-file-upload-react@3.0.6) (2018-11-08)
91
-
92
- ### Bug Fixes
93
-
94
- - **ffe-file-upload-react:** fixed async issues with setState ([0a6b546](https://github.com/SpareBank1/designsystem/commit/0a6b546))
95
-
96
- <a name="3.0.5"></a>
97
-
98
- ## [3.0.5](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.4...@sb1/ffe-file-upload-react@3.0.5) (2018-08-09)
99
-
100
- **Note:** Version bump only for package @sb1/ffe-file-upload-react
101
-
102
- <a name="3.0.4"></a>
103
-
104
- ## [3.0.4](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.3...@sb1/ffe-file-upload-react@3.0.4) (2018-06-20)
105
-
106
- ### Bug Fixes
107
-
108
- - **ffe-file-upload-react:** added peerDependency to ffe-core@^13.0.0 ([bb426a9](https://github.com/SpareBank1/designsystem/commit/bb426a9))
109
-
110
- <a name="3.0.3"></a>
111
-
112
- ## [3.0.3](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.2...@sb1/ffe-file-upload-react@3.0.3) (2018-03-27)
113
-
114
- **Note:** Version bump only for package @sb1/ffe-file-upload-react
115
-
116
- <a name="3.0.2"></a>
117
-
118
- ## [3.0.2](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.0...@sb1/ffe-file-upload-react@3.0.2) (2018-03-07)
119
-
120
- ### Bug Fixes
121
-
122
- - Correct peerDependencies after breaking change ([aab59ce](https://github.com/SpareBank1/designsystem/commit/aab59ce))
123
-
124
- <a name="3.0.1"></a>
125
-
126
- ## [3.0.1](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-file-upload-react@3.0.0...@sb1/ffe-file-upload-react@3.0.1) (2018-03-02)
127
-
128
- ### Bug Fixes
129
-
130
- - Correct peerDependencies after breaking change ([4318363](https://github.com/SpareBank1/designsystem/commit/4318363))
131
-
132
- <a name="3.0.0"></a>
133
-
134
- # 3.0.0 (2018-02-25)
135
-
136
- ### Chores
137
-
138
- - **ffe-file-upload-react:** Moving in ([870b07f](https://github.com/SpareBank1/designsystem/commit/870b07f))
139
- - add [@sb1](https://github.com/sb1)/ scope to all packages ([37efbb4](https://github.com/SpareBank1/designsystem/commit/37efbb4))
140
-
141
- ### BREAKING CHANGES
142
-
143
- - All packages have been renamed to add the @sb1 scope.
144
-
145
- See links [1] and [2] to read more about package scopes.
146
-
147
- Unfortunately this requires you update both your dependencies in
148
- `package.json` and all `import` or `require` statements in your code.
149
- Also, you unfortunately have to upgrade all FFE packages at once due to
150
- dependency between packages. If you are on the latest version prior to
151
- this breaking change the upgrade should be a matter of updating
152
- `package.json` with new package names and versions, and updating your
153
- imports.
154
-
155
- To help find the proper package versions you can either browse to the
156
- packages you need or check out the list of Git tags either on
157
- Github [3] or by cloning the repository and running the `git tag`
158
- command. All package versions get a tag in the format
159
- _package@version_.
160
-
161
- Update your `package.json` with the latest package version and add the
162
- @sb1 scope to the package name:
163
-
164
- ```diff
165
- - "ffe-core": "11.0.2",
166
- + "@sb1/ffe-core": "11.0.2",
167
- ```
168
-
169
- Scoped packages all get put in a subdirectory in `node_modules/`. In our
170
- case packages will be put in the `node_modules/@sb1/` directory. If your
171
- build depends on file paths (for instance for copying fonts) you need to
172
- update that path to include the scope.
173
-
174
- The directory structure also means you have to update your imports, both
175
- in Less and in JavaScript.
176
-
177
- Using `less-plugin-npm-import`:
178
-
179
- ```diff
180
- - @import 'npm://ffe-core/less/ffe';
181
- + @import 'npm://@sb1/ffe-core/less/ffe';
182
- ```
183
-
184
- Using Webpack:
185
-
186
- ```diff
187
- - @import '~ffe-core/less/ffe';
188
- + @import '~@sb1/ffe-core/less/ffe';
189
- ```
190
-
191
- Using plain old paths:
192
-
193
- ```diff
194
- - @import '../path/to/node_modules/ffe-core/less/ffe';
195
- + @import '../path/to/node_modules/@sb1/ffe-core/less/ffe';
196
- ```
197
-
198
- JavaScript `import`:
199
-
200
- ```diff
201
- - import { ActionButton } from 'ffe-buttons-react';
202
- + import { ActionButton } from '@sb1/ffe-buttons-react';
203
- ```
204
-
205
- JavaScript `require`:
206
-
207
- ```diff
208
- - const { ActionButton } = require('ffe-buttons-react').default;
209
- + const { ActionButton } = require('@sb1/ffe-buttons-react').default;
210
- ```
211
-
212
- [1]: https://docs.npmjs.com/misc/scope
213
- [2]: https://docs.npmjs.com/getting-started/scoped-packages
214
- [3]: https://github.com/sparebank1/designsystem/tags
215
-
216
- - **ffe-file-upload-react:** Requires React 16.2 or newer
217
-
218
- With this ffe-file-upload-react is moved to the monorepo. A breaking
219
- change is introduced to remove support for React 15. The upgrade should
220
- be a drop-in upgrade for users of React 16.2 or newer.
221
-
222
- <a name="2.0.6"></a>
223
-
224
- ## [2.0.6](https://github.com/SpareBank1/designsystem/compare/ffe-file-upload-react@2.0.5...ffe-file-upload-react@2.0.6) (2018-02-23)
225
-
226
- **Note:** Version bump only for package ffe-file-upload-react
227
-
228
- <a name="2.0.5"></a>
229
-
230
- ## [2.0.5](https://github.com/SpareBank1/designsystem/compare/ffe-file-upload-react@2.0.4...ffe-file-upload-react@2.0.5) (2018-02-22)
231
-
232
- **Note:** Version bump only for package ffe-file-upload-react
233
-
234
- <a name="2.0.4"></a>
235
-
236
- ## [2.0.4](https://github.com/SpareBank1/designsystem/compare/ffe-file-upload-react@2.0.3...ffe-file-upload-react@2.0.4) (2018-02-16)
237
-
238
- **Note:** Version bump only for package ffe-file-upload-react
239
-
240
- <a name="2.0.3"></a>
241
-
242
- ## [2.0.3](https://github.com/SpareBank1/designsystem/compare/ffe-file-upload-react@2.0.2...ffe-file-upload-react@2.0.3) (2018-01-22)
243
-
244
- **Note:** Version bump only for package ffe-file-upload-react
245
-
246
- <a name="2.0.2"></a>
247
-
248
- ## [2.0.2](https://github.com/SpareBank1/designsystem/compare/ffe-file-upload-react@2.0.1...ffe-file-upload-react@2.0.2) (2018-01-19)
249
-
250
- **Note:** Version bump only for package ffe-file-upload-react
251
-
252
- <a name="2.0.1"></a>
253
-
254
- ## [2.0.1](https://github.com/SpareBank1/designsystem/compare/ffe-file-upload-react@2.0.0...ffe-file-upload-react@2.0.1) (2018-01-18)
255
-
256
- **Note:** Version bump only for package ffe-file-upload-react
257
-
258
- <a name="2.0.0"></a>
259
-
260
- # 2.0.0 (2018-01-12)
261
-
262
- ### Chores
263
-
264
- - **ffe-file-upload-react:** Moving in
265
-
266
- ### BREAKING CHANGES
267
-
268
- - **ffe-file-upload-react:** Requires React 16.2 or newer
269
-
270
- With this ffe-file-upload-react is moved to the monorepo. A breaking
271
- change is introduced to remove support for React 15. The upgrade should
272
- be a drop-in upgrade for users of React 16.2 or newer.
273
-
274
- # 1.2.0
275
-
276
- - aria-label is now set by label
277
-
278
- # 1.1.0
279
-
280
- - Moved clearing of input to enable multiple upload
281
- - Adding success and info message support
282
- - Adding support for multiple error messages
283
-
284
- ## 1.0.1
285
-
286
- - Fixed bug where file input element was not cleared after each upload(causing sequential upload of files with same filename to not perform onChange and therefore no upload)
287
-
288
- # 1.0.0
289
-
290
- - Initial version
@@ -1,54 +0,0 @@
1
- import React from 'react';
2
- import sinon from 'sinon';
3
- import { shallow } from 'enzyme';
4
- import FileUpload from '../src/FileUpload';
5
- describe('<FileUpload/>', function () {
6
- var component;
7
- var onFilesSelected;
8
- var onFileDeleted;
9
- var onFilesDropped;
10
- beforeEach(function () {
11
- onFilesSelected = sinon.spy();
12
- onFileDeleted = sinon.spy();
13
- onFilesDropped = sinon.spy();
14
- });
15
- describe('initial state', function () {
16
- beforeEach(function () {
17
- component = shallow( /*#__PURE__*/React.createElement(FileUpload, {
18
- id: "file-upload",
19
- label: "label",
20
- title: "title",
21
- infoText: "infoText",
22
- uploadTitle: "uploadTitle",
23
- uploadMicroText: "uploadMicroText",
24
- uploadSubText: "uploadSubText",
25
- files: {},
26
- onFilesSelected: onFilesSelected,
27
- onFileDeleted: onFileDeleted,
28
- onFilesDropped: onFilesDropped
29
- }));
30
- });
31
- it('should have a button and input', function () {
32
- expect(component.find('.ffe-file-upload__upload-button').exists()).toBe(true);
33
- expect(component.find('#file-upload').exists()).toBe(true);
34
- });
35
- it('should render input label', function () {
36
- expect(component.find('.ffe-file-upload__upload-button').text()).toBe('label');
37
- });
38
- it('should add label as aria-label', function () {
39
- expect(component.find('#file-upload-label').text()).toBe('label');
40
- });
41
- it('should extract and return files when user finishes selecting files', function () {
42
- component.find('#file-upload').simulate('change', {
43
- target: {
44
- files: {
45
- filename: {
46
- name: 'filename'
47
- }
48
- }
49
- }
50
- });
51
- expect(onFilesSelected.calledOnce).toBe(true);
52
- });
53
- });
54
- });
@@ -1,62 +0,0 @@
1
- "use strict";
2
-
3
- var _react = _interopRequireDefault(require("react"));
4
-
5
- var _sinon = _interopRequireDefault(require("sinon"));
6
-
7
- var _enzyme = require("enzyme");
8
-
9
- var _FileUpload = _interopRequireDefault(require("../src/FileUpload"));
10
-
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
-
13
- describe('<FileUpload/>', function () {
14
- var component;
15
- var onFilesSelected;
16
- var onFileDeleted;
17
- var onFilesDropped;
18
- beforeEach(function () {
19
- onFilesSelected = _sinon.default.spy();
20
- onFileDeleted = _sinon.default.spy();
21
- onFilesDropped = _sinon.default.spy();
22
- });
23
- describe('initial state', function () {
24
- beforeEach(function () {
25
- component = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_FileUpload.default, {
26
- id: "file-upload",
27
- label: "label",
28
- title: "title",
29
- infoText: "infoText",
30
- uploadTitle: "uploadTitle",
31
- uploadMicroText: "uploadMicroText",
32
- uploadSubText: "uploadSubText",
33
- files: {},
34
- onFilesSelected: onFilesSelected,
35
- onFileDeleted: onFileDeleted,
36
- onFilesDropped: onFilesDropped
37
- }));
38
- });
39
- it('should have a button and input', function () {
40
- expect(component.find('.ffe-file-upload__upload-button').exists()).toBe(true);
41
- expect(component.find('#file-upload').exists()).toBe(true);
42
- });
43
- it('should render input label', function () {
44
- expect(component.find('.ffe-file-upload__upload-button').text()).toBe('label');
45
- });
46
- it('should add label as aria-label', function () {
47
- expect(component.find('#file-upload-label').text()).toBe('label');
48
- });
49
- it('should extract and return files when user finishes selecting files', function () {
50
- component.find('#file-upload').simulate('change', {
51
- target: {
52
- files: {
53
- filename: {
54
- name: 'filename'
55
- }
56
- }
57
- }
58
- });
59
- expect(onFilesSelected.calledOnce).toBe(true);
60
- });
61
- });
62
- });