@comicrelief/storybook 1.30.2 → 1.30.4
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/build/index.js +1 -1
- package/coverage/clover.xml +177 -0
- package/coverage/coverage-final.json +9 -0
- package/coverage/lcov-report/base.css +212 -0
- package/coverage/lcov-report/index.html +125 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +1 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +158 -0
- package/coverage/lcov-report/src/components/FileUp/FileUp.js.html +543 -0
- package/coverage/lcov-report/src/components/FileUp/index.html +73 -0
- package/coverage/lcov-report/src/components/FileUp/src/service/S3FileUploadService.js.html +177 -0
- package/coverage/lcov-report/src/components/FileUp/src/service/index.html +73 -0
- package/coverage/lcov-report/src/components/SchoolsLookUp/SchoolsLookUp.js.html +1725 -0
- package/coverage/lcov-report/src/components/SchoolsLookUp/index.html +73 -0
- package/coverage/lcov-report/src/utils/index.html +73 -0
- package/coverage/lcov-report/src/utils/newid.js.html +63 -0
- package/coverage/lcov-report/tests/mocks/enzyme.js.html +69 -0
- package/coverage/lcov-report/tests/mocks/fileMock.js.html +48 -0
- package/coverage/lcov-report/tests/mocks/index.html +112 -0
- package/coverage/lcov-report/tests/mocks/shim.js.html +54 -0
- package/coverage/lcov-report/tests/mocks/styleMock.js.html +48 -0
- package/coverage/lcov.info +400 -0
- package/cypress/snapshots/All Specs/__diff_output__/Browser Support message -- should load default story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Checkbox Field -- should click checkbox.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Checkbox Field -- should load default story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Cookie Consent Message -- should load default story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/File Upload -- should load default story.diff.png +0 -0
- package/package.json +1 -1
- package/src/components/PostcodeLookup/PostcodeLookup.js +6 -1
- package/cypress/snapshots/All Specs/__diff_output__/Grants Infographics -- should load default story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Input Field -- should load Checkbox story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Input Field -- should load Email Field story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Input Field -- should load Number Field story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Input Field -- should load Number Field with all props possible story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Input Field -- should load Optional text Field with only required props story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Input Field -- should load Telephone Field story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Input Field -- should load Text Field story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Input Field -- should load Text Field with inline button story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Just In Time Message -- should load default story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Marketing Consent -- should load default story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Postcode Lookup -- should load default story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Postcode Lookup -- should load results.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Radio Buttons -- should load default story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Schools Lookup -- should load EDCO selected school story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Schools Lookup -- should load manual fields errors story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Schools Lookup -- should load manually entered school story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Schools Lookup -- should load nothing is selected story.diff.png +0 -0
- package/cypress/snapshots/All Specs/__diff_output__/Schools Lookup -- should load results.diff.png +0 -0
- package/yarn-error.log +0 -15344
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>Code coverage report for src/components/FileUp/FileUp.js</title>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<link rel="stylesheet" href="../../../prettify.css" />
|
|
7
|
+
<link rel="stylesheet" href="../../../base.css" />
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
|
+
<style type='text/css'>
|
|
10
|
+
.coverage-summary .sorter {
|
|
11
|
+
background-image: url(../../../sort-arrow-sprite.png);
|
|
12
|
+
}
|
|
13
|
+
</style>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div class='wrapper'>
|
|
17
|
+
<div class='pad1'>
|
|
18
|
+
<h1>
|
|
19
|
+
<a href="../../../index.html">All files</a> / <a href="index.html">src/components/FileUp</a> FileUp.js
|
|
20
|
+
</h1>
|
|
21
|
+
<div class='clearfix'>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<div class='status-line low'></div>
|
|
25
|
+
<pre><table class="coverage">
|
|
26
|
+
<tr><td class="line-count quiet">1
|
|
27
|
+
2
|
|
28
|
+
3
|
|
29
|
+
4
|
|
30
|
+
5
|
|
31
|
+
6
|
|
32
|
+
7
|
|
33
|
+
8
|
|
34
|
+
9
|
|
35
|
+
10
|
|
36
|
+
11
|
|
37
|
+
12
|
|
38
|
+
13
|
|
39
|
+
14
|
|
40
|
+
15
|
|
41
|
+
16
|
|
42
|
+
17
|
|
43
|
+
18
|
|
44
|
+
19
|
|
45
|
+
20
|
|
46
|
+
21
|
|
47
|
+
22
|
|
48
|
+
23
|
|
49
|
+
24
|
|
50
|
+
25
|
|
51
|
+
26
|
|
52
|
+
27
|
|
53
|
+
28
|
|
54
|
+
29
|
|
55
|
+
30
|
|
56
|
+
31
|
|
57
|
+
32
|
|
58
|
+
33
|
|
59
|
+
34
|
|
60
|
+
35
|
|
61
|
+
36
|
|
62
|
+
37
|
|
63
|
+
38
|
|
64
|
+
39
|
|
65
|
+
40
|
|
66
|
+
41
|
|
67
|
+
42
|
|
68
|
+
43
|
|
69
|
+
44
|
|
70
|
+
45
|
|
71
|
+
46
|
|
72
|
+
47
|
|
73
|
+
48
|
|
74
|
+
49
|
|
75
|
+
50
|
|
76
|
+
51
|
|
77
|
+
52
|
|
78
|
+
53
|
|
79
|
+
54
|
|
80
|
+
55
|
|
81
|
+
56
|
|
82
|
+
57
|
|
83
|
+
58
|
|
84
|
+
59
|
|
85
|
+
60
|
|
86
|
+
61
|
|
87
|
+
62
|
|
88
|
+
63
|
|
89
|
+
64
|
|
90
|
+
65
|
|
91
|
+
66
|
|
92
|
+
67
|
|
93
|
+
68
|
|
94
|
+
69
|
|
95
|
+
70
|
|
96
|
+
71
|
|
97
|
+
72
|
|
98
|
+
73
|
|
99
|
+
74
|
|
100
|
+
75
|
|
101
|
+
76
|
|
102
|
+
77
|
|
103
|
+
78
|
|
104
|
+
79
|
|
105
|
+
80
|
|
106
|
+
81
|
|
107
|
+
82
|
|
108
|
+
83
|
|
109
|
+
84
|
|
110
|
+
85
|
|
111
|
+
86
|
|
112
|
+
87
|
|
113
|
+
88
|
|
114
|
+
89
|
|
115
|
+
90
|
|
116
|
+
91
|
|
117
|
+
92
|
|
118
|
+
93
|
|
119
|
+
94
|
|
120
|
+
95
|
|
121
|
+
96
|
|
122
|
+
97
|
|
123
|
+
98
|
|
124
|
+
99
|
|
125
|
+
100
|
|
126
|
+
101
|
|
127
|
+
102
|
|
128
|
+
103
|
|
129
|
+
104
|
|
130
|
+
105
|
|
131
|
+
106
|
|
132
|
+
107
|
|
133
|
+
108
|
|
134
|
+
109
|
|
135
|
+
110
|
|
136
|
+
111
|
|
137
|
+
112
|
|
138
|
+
113
|
|
139
|
+
114
|
|
140
|
+
115
|
|
141
|
+
116
|
|
142
|
+
117
|
|
143
|
+
118
|
|
144
|
+
119
|
|
145
|
+
120
|
|
146
|
+
121
|
|
147
|
+
122
|
|
148
|
+
123
|
|
149
|
+
124
|
|
150
|
+
125
|
|
151
|
+
126
|
|
152
|
+
127
|
|
153
|
+
128
|
|
154
|
+
129
|
|
155
|
+
130
|
|
156
|
+
131
|
|
157
|
+
132
|
|
158
|
+
133
|
|
159
|
+
134
|
|
160
|
+
135
|
|
161
|
+
136
|
|
162
|
+
137
|
|
163
|
+
138
|
|
164
|
+
139
|
|
165
|
+
140
|
|
166
|
+
141
|
|
167
|
+
142
|
|
168
|
+
143
|
|
169
|
+
144
|
|
170
|
+
145
|
|
171
|
+
146
|
|
172
|
+
147
|
|
173
|
+
148
|
|
174
|
+
149
|
|
175
|
+
150
|
|
176
|
+
151
|
|
177
|
+
152
|
|
178
|
+
153
|
|
179
|
+
154
|
|
180
|
+
155
|
|
181
|
+
156
|
|
182
|
+
157
|
|
183
|
+
158
|
|
184
|
+
159
|
|
185
|
+
160
|
|
186
|
+
161
|
|
187
|
+
162
|
|
188
|
+
163
|
|
189
|
+
164
|
|
190
|
+
165
|
|
191
|
+
166
|
|
192
|
+
167</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
193
|
+
<span class="cline-any cline-neutral"> </span>
|
|
194
|
+
<span class="cline-any cline-neutral"> </span>
|
|
195
|
+
<span class="cline-any cline-neutral"> </span>
|
|
196
|
+
<span class="cline-any cline-neutral"> </span>
|
|
197
|
+
<span class="cline-any cline-neutral"> </span>
|
|
198
|
+
<span class="cline-any cline-neutral"> </span>
|
|
199
|
+
<span class="cline-any cline-neutral"> </span>
|
|
200
|
+
<span class="cline-any cline-neutral"> </span>
|
|
201
|
+
<span class="cline-any cline-neutral"> </span>
|
|
202
|
+
<span class="cline-any cline-neutral"> </span>
|
|
203
|
+
<span class="cline-any cline-neutral"> </span>
|
|
204
|
+
<span class="cline-any cline-yes">1x</span>
|
|
205
|
+
<span class="cline-any cline-yes">1x</span>
|
|
206
|
+
<span class="cline-any cline-neutral"> </span>
|
|
207
|
+
<span class="cline-any cline-neutral"> </span>
|
|
208
|
+
<span class="cline-any cline-neutral"> </span>
|
|
209
|
+
<span class="cline-any cline-neutral"> </span>
|
|
210
|
+
<span class="cline-any cline-yes">1x</span>
|
|
211
|
+
<span class="cline-any cline-neutral"> </span>
|
|
212
|
+
<span class="cline-any cline-neutral"> </span>
|
|
213
|
+
<span class="cline-any cline-neutral"> </span>
|
|
214
|
+
<span class="cline-any cline-neutral"> </span>
|
|
215
|
+
<span class="cline-any cline-neutral"> </span>
|
|
216
|
+
<span class="cline-any cline-neutral"> </span>
|
|
217
|
+
<span class="cline-any cline-yes">1x</span>
|
|
218
|
+
<span class="cline-any cline-neutral"> </span>
|
|
219
|
+
<span class="cline-any cline-neutral"> </span>
|
|
220
|
+
<span class="cline-any cline-neutral"> </span>
|
|
221
|
+
<span class="cline-any cline-neutral"> </span>
|
|
222
|
+
<span class="cline-any cline-neutral"> </span>
|
|
223
|
+
<span class="cline-any cline-neutral"> </span>
|
|
224
|
+
<span class="cline-any cline-neutral"> </span>
|
|
225
|
+
<span class="cline-any cline-neutral"> </span>
|
|
226
|
+
<span class="cline-any cline-no"> </span>
|
|
227
|
+
<span class="cline-any cline-no"> </span>
|
|
228
|
+
<span class="cline-any cline-no"> </span>
|
|
229
|
+
<span class="cline-any cline-no"> </span>
|
|
230
|
+
<span class="cline-any cline-neutral"> </span>
|
|
231
|
+
<span class="cline-any cline-neutral"> </span>
|
|
232
|
+
<span class="cline-any cline-no"> </span>
|
|
233
|
+
<span class="cline-any cline-no"> </span>
|
|
234
|
+
<span class="cline-any cline-no"> </span>
|
|
235
|
+
<span class="cline-any cline-neutral"> </span>
|
|
236
|
+
<span class="cline-any cline-neutral"> </span>
|
|
237
|
+
<span class="cline-any cline-neutral"> </span>
|
|
238
|
+
<span class="cline-any cline-no"> </span>
|
|
239
|
+
<span class="cline-any cline-neutral"> </span>
|
|
240
|
+
<span class="cline-any cline-neutral"> </span>
|
|
241
|
+
<span class="cline-any cline-neutral"> </span>
|
|
242
|
+
<span class="cline-any cline-neutral"> </span>
|
|
243
|
+
<span class="cline-any cline-no"> </span>
|
|
244
|
+
<span class="cline-any cline-no"> </span>
|
|
245
|
+
<span class="cline-any cline-no"> </span>
|
|
246
|
+
<span class="cline-any cline-no"> </span>
|
|
247
|
+
<span class="cline-any cline-no"> </span>
|
|
248
|
+
<span class="cline-any cline-neutral"> </span>
|
|
249
|
+
<span class="cline-any cline-neutral"> </span>
|
|
250
|
+
<span class="cline-any cline-neutral"> </span>
|
|
251
|
+
<span class="cline-any cline-neutral"> </span>
|
|
252
|
+
<span class="cline-any cline-no"> </span>
|
|
253
|
+
<span class="cline-any cline-no"> </span>
|
|
254
|
+
<span class="cline-any cline-neutral"> </span>
|
|
255
|
+
<span class="cline-any cline-neutral"> </span>
|
|
256
|
+
<span class="cline-any cline-neutral"> </span>
|
|
257
|
+
<span class="cline-any cline-no"> </span>
|
|
258
|
+
<span class="cline-any cline-neutral"> </span>
|
|
259
|
+
<span class="cline-any cline-neutral"> </span>
|
|
260
|
+
<span class="cline-any cline-neutral"> </span>
|
|
261
|
+
<span class="cline-any cline-neutral"> </span>
|
|
262
|
+
<span class="cline-any cline-neutral"> </span>
|
|
263
|
+
<span class="cline-any cline-neutral"> </span>
|
|
264
|
+
<span class="cline-any cline-no"> </span>
|
|
265
|
+
<span class="cline-any cline-neutral"> </span>
|
|
266
|
+
<span class="cline-any cline-neutral"> </span>
|
|
267
|
+
<span class="cline-any cline-neutral"> </span>
|
|
268
|
+
<span class="cline-any cline-neutral"> </span>
|
|
269
|
+
<span class="cline-any cline-neutral"> </span>
|
|
270
|
+
<span class="cline-any cline-neutral"> </span>
|
|
271
|
+
<span class="cline-any cline-neutral"> </span>
|
|
272
|
+
<span class="cline-any cline-neutral"> </span>
|
|
273
|
+
<span class="cline-any cline-no"> </span>
|
|
274
|
+
<span class="cline-any cline-no"> </span>
|
|
275
|
+
<span class="cline-any cline-no"> </span>
|
|
276
|
+
<span class="cline-any cline-no"> </span>
|
|
277
|
+
<span class="cline-any cline-no"> </span>
|
|
278
|
+
<span class="cline-any cline-neutral"> </span>
|
|
279
|
+
<span class="cline-any cline-neutral"> </span>
|
|
280
|
+
<span class="cline-any cline-neutral"> </span>
|
|
281
|
+
<span class="cline-any cline-no"> </span>
|
|
282
|
+
<span class="cline-any cline-neutral"> </span>
|
|
283
|
+
<span class="cline-any cline-neutral"> </span>
|
|
284
|
+
<span class="cline-any cline-neutral"> </span>
|
|
285
|
+
<span class="cline-any cline-neutral"> </span>
|
|
286
|
+
<span class="cline-any cline-neutral"> </span>
|
|
287
|
+
<span class="cline-any cline-neutral"> </span>
|
|
288
|
+
<span class="cline-any cline-neutral"> </span>
|
|
289
|
+
<span class="cline-any cline-yes">1x</span>
|
|
290
|
+
<span class="cline-any cline-neutral"> </span>
|
|
291
|
+
<span class="cline-any cline-neutral"> </span>
|
|
292
|
+
<span class="cline-any cline-neutral"> </span>
|
|
293
|
+
<span class="cline-any cline-neutral"> </span>
|
|
294
|
+
<span class="cline-any cline-neutral"> </span>
|
|
295
|
+
<span class="cline-any cline-neutral"> </span>
|
|
296
|
+
<span class="cline-any cline-neutral"> </span>
|
|
297
|
+
<span class="cline-any cline-neutral"> </span>
|
|
298
|
+
<span class="cline-any cline-no"> </span>
|
|
299
|
+
<span class="cline-any cline-neutral"> </span>
|
|
300
|
+
<span class="cline-any cline-neutral"> </span>
|
|
301
|
+
<span class="cline-any cline-neutral"> </span>
|
|
302
|
+
<span class="cline-any cline-neutral"> </span>
|
|
303
|
+
<span class="cline-any cline-neutral"> </span>
|
|
304
|
+
<span class="cline-any cline-neutral"> </span>
|
|
305
|
+
<span class="cline-any cline-neutral"> </span>
|
|
306
|
+
<span class="cline-any cline-neutral"> </span>
|
|
307
|
+
<span class="cline-any cline-neutral"> </span>
|
|
308
|
+
<span class="cline-any cline-neutral"> </span>
|
|
309
|
+
<span class="cline-any cline-neutral"> </span>
|
|
310
|
+
<span class="cline-any cline-neutral"> </span>
|
|
311
|
+
<span class="cline-any cline-neutral"> </span>
|
|
312
|
+
<span class="cline-any cline-neutral"> </span>
|
|
313
|
+
<span class="cline-any cline-neutral"> </span>
|
|
314
|
+
<span class="cline-any cline-neutral"> </span>
|
|
315
|
+
<span class="cline-any cline-neutral"> </span>
|
|
316
|
+
<span class="cline-any cline-neutral"> </span>
|
|
317
|
+
<span class="cline-any cline-neutral"> </span>
|
|
318
|
+
<span class="cline-any cline-neutral"> </span>
|
|
319
|
+
<span class="cline-any cline-neutral"> </span>
|
|
320
|
+
<span class="cline-any cline-neutral"> </span>
|
|
321
|
+
<span class="cline-any cline-neutral"> </span>
|
|
322
|
+
<span class="cline-any cline-neutral"> </span>
|
|
323
|
+
<span class="cline-any cline-neutral"> </span>
|
|
324
|
+
<span class="cline-any cline-neutral"> </span>
|
|
325
|
+
<span class="cline-any cline-neutral"> </span>
|
|
326
|
+
<span class="cline-any cline-neutral"> </span>
|
|
327
|
+
<span class="cline-any cline-neutral"> </span>
|
|
328
|
+
<span class="cline-any cline-neutral"> </span>
|
|
329
|
+
<span class="cline-any cline-neutral"> </span>
|
|
330
|
+
<span class="cline-any cline-neutral"> </span>
|
|
331
|
+
<span class="cline-any cline-neutral"> </span>
|
|
332
|
+
<span class="cline-any cline-neutral"> </span>
|
|
333
|
+
<span class="cline-any cline-neutral"> </span>
|
|
334
|
+
<span class="cline-any cline-neutral"> </span>
|
|
335
|
+
<span class="cline-any cline-neutral"> </span>
|
|
336
|
+
<span class="cline-any cline-neutral"> </span>
|
|
337
|
+
<span class="cline-any cline-neutral"> </span>
|
|
338
|
+
<span class="cline-any cline-neutral"> </span>
|
|
339
|
+
<span class="cline-any cline-neutral"> </span>
|
|
340
|
+
<span class="cline-any cline-neutral"> </span>
|
|
341
|
+
<span class="cline-any cline-neutral"> </span>
|
|
342
|
+
<span class="cline-any cline-neutral"> </span>
|
|
343
|
+
<span class="cline-any cline-neutral"> </span>
|
|
344
|
+
<span class="cline-any cline-neutral"> </span>
|
|
345
|
+
<span class="cline-any cline-neutral"> </span>
|
|
346
|
+
<span class="cline-any cline-neutral"> </span>
|
|
347
|
+
<span class="cline-any cline-neutral"> </span>
|
|
348
|
+
<span class="cline-any cline-yes">1x</span>
|
|
349
|
+
<span class="cline-any cline-neutral"> </span>
|
|
350
|
+
<span class="cline-any cline-neutral"> </span>
|
|
351
|
+
<span class="cline-any cline-neutral"> </span>
|
|
352
|
+
<span class="cline-any cline-neutral"> </span>
|
|
353
|
+
<span class="cline-any cline-neutral"> </span>
|
|
354
|
+
<span class="cline-any cline-neutral"> </span>
|
|
355
|
+
<span class="cline-any cline-neutral"> </span>
|
|
356
|
+
<span class="cline-any cline-neutral"> </span>
|
|
357
|
+
<span class="cline-any cline-neutral"> </span>
|
|
358
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import React, { Component } from 'react';
|
|
359
|
+
import propTypes from 'prop-types';
|
|
360
|
+
import Dropzone from 'react-dropzone';
|
|
361
|
+
import './styles.scss';
|
|
362
|
+
import PdfImage from './Images/pdficon.png';
|
|
363
|
+
import newId from '../../utils/newid';
|
|
364
|
+
|
|
365
|
+
class FileUp extends Component {
|
|
366
|
+
/**
|
|
367
|
+
* FileUp constructor.
|
|
368
|
+
*/
|
|
369
|
+
constructor() {
|
|
370
|
+
super();
|
|
371
|
+
this.state = {
|
|
372
|
+
files: [],
|
|
373
|
+
rejected: [],
|
|
374
|
+
bigFile: false,
|
|
375
|
+
};
|
|
376
|
+
this.onDrop = this.onDrop.bind(this);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* On component mount.
|
|
381
|
+
*/
|
|
382
|
+
componentWillMount() {
|
|
383
|
+
this.dropZoneId = newId('dropzone-');
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* On file drop.
|
|
388
|
+
* @param files
|
|
389
|
+
* @param rejected
|
|
390
|
+
*/
|
|
391
|
+
<span class="fstat-no" title="function not covered" > on</span>Drop(files, rejected) {
|
|
392
|
+
const max = <span class="cstat-no" title="statement not covered" >this.props.maxFiles;</span>
|
|
393
|
+
const filesCombined = <span class="cstat-no" title="statement not covered" >[...this.state.files, ...files];</span>
|
|
394
|
+
<span class="cstat-no" title="statement not covered" > if (filesCombined.length > max) {</span>
|
|
395
|
+
<span class="cstat-no" title="statement not covered" > this.setState({</span>
|
|
396
|
+
error: `You can only upload max ${max} files.`,
|
|
397
|
+
});
|
|
398
|
+
} else <span class="cstat-no" title="statement not covered" >if (rejected.length > 0) {</span>
|
|
399
|
+
<span class="cstat-no" title="statement not covered" > if (rejected[0].size > this.props.maxSize) {</span>
|
|
400
|
+
<span class="cstat-no" title="statement not covered" > this.setState({</span>
|
|
401
|
+
error: `File/s exceed maximum size. Maximum size for each file is ${this.props.maxSize / 1000000}MB`,
|
|
402
|
+
});
|
|
403
|
+
} else {
|
|
404
|
+
<span class="cstat-no" title="statement not covered" > this.setState({</span>
|
|
405
|
+
error: 'File type not accepted. Please upload JPG, PNG or PDF',
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
} else {
|
|
409
|
+
let dupe = <span class="cstat-no" title="statement not covered" >false;</span>
|
|
410
|
+
<span class="cstat-no" title="statement not covered" > files.forEach(<span class="fstat-no" title="function not covered" >(f</span>ile1) => {</span>
|
|
411
|
+
<span class="cstat-no" title="statement not covered" > this.state.files.forEach(<span class="fstat-no" title="function not covered" >(f</span>ile2) => {</span>
|
|
412
|
+
<span class="cstat-no" title="statement not covered" > if (file1.name === file2.name) {</span>
|
|
413
|
+
<span class="cstat-no" title="statement not covered" > dupe = true;</span>
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
<span class="cstat-no" title="statement not covered" > if (dupe) {</span>
|
|
419
|
+
<span class="cstat-no" title="statement not covered" > this.setState({</span>
|
|
420
|
+
error: 'You cannot upload the same file twice. Please try again.',
|
|
421
|
+
});
|
|
422
|
+
} else {
|
|
423
|
+
<span class="cstat-no" title="statement not covered" > this.setState({</span>
|
|
424
|
+
rejected,
|
|
425
|
+
files: filesCombined,
|
|
426
|
+
error: '',
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
<span class="cstat-no" title="statement not covered" > this.props.onChange();</span>
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Image delete handler.
|
|
435
|
+
* @param e
|
|
436
|
+
*/
|
|
437
|
+
|
|
438
|
+
<span class="fstat-no" title="function not covered" > re</span>moveFile(file, e) {
|
|
439
|
+
<span class="cstat-no" title="statement not covered" > e.preventDefault();</span>
|
|
440
|
+
const newState = <span class="cstat-no" title="statement not covered" >this.state.files;</span>
|
|
441
|
+
<span class="cstat-no" title="statement not covered" > if (newState.indexOf(file) > -1) {</span>
|
|
442
|
+
<span class="cstat-no" title="statement not covered" > newState.splice(newState.indexOf(file), 1);</span>
|
|
443
|
+
<span class="cstat-no" title="statement not covered" > this.setState({</span>
|
|
444
|
+
files: newState,
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
<span class="cstat-no" title="statement not covered" > this.props.onChange();</span>
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Component render.
|
|
452
|
+
* @return {XML}
|
|
453
|
+
*/
|
|
454
|
+
render() {
|
|
455
|
+
return (
|
|
456
|
+
<section>
|
|
457
|
+
<div className="dropzone__wrapper">
|
|
458
|
+
<p className="font--centre">Upload designs as separate files<br />
|
|
459
|
+
Max file size per file: {this.props.maxSize / 1000000}MB<br />
|
|
460
|
+
File types accepted: JPG, PNG and PDF</p>
|
|
461
|
+
{this.state.files.length > 0 ?
|
|
462
|
+
<span class="branch-0 cbranch-no" title="branch not covered" > <div className="file-up__img-uploaded"></span>
|
|
463
|
+
{this.state.files.map(<span class="fstat-no" title="function not covered" >fi</span>le =>
|
|
464
|
+
(<span class="cstat-no" title="statement not covered" ><span key={file.name} className="preview"></span>
|
|
465
|
+
{(file.type === 'application/pdf') ?
|
|
466
|
+
<img src={PdfImage} alt="" /> : <img src={file.preview} alt="" />}
|
|
467
|
+
<p className="font--small font--centre">
|
|
468
|
+
<button
|
|
469
|
+
className="link"
|
|
470
|
+
onClick={this.removeFile.bind(this, file)}
|
|
471
|
+
>
|
|
472
|
+
Remove
|
|
473
|
+
</button>
|
|
474
|
+
</p>
|
|
475
|
+
</span>),
|
|
476
|
+
)}
|
|
477
|
+
</div>
|
|
478
|
+
: null}
|
|
479
|
+
{this.state.error ?
|
|
480
|
+
<span class="branch-0 cbranch-no" title="branch not covered" > <p className="font--centre error">{this.state.error}</p></span>
|
|
481
|
+
: null}
|
|
482
|
+
{this.state.files.length === this.props.maxFiles ?
|
|
483
|
+
<span class="branch-0 cbranch-no" title="branch not covered" > <p className="font--centre error"></span>
|
|
484
|
+
You&apos;ve reached your maximum amount of {this.props.maxFiles} files.
|
|
485
|
+
</p>
|
|
486
|
+
: null}
|
|
487
|
+
{this.state.files.length < this.props.maxFiles ?
|
|
488
|
+
<label htmlFor={this.dropZoneId}><span className="labelSpan">Image upload</span>
|
|
489
|
+
<Dropzone
|
|
490
|
+
id={this.dropZoneId}
|
|
491
|
+
className="dropzone"
|
|
492
|
+
maxSize={this.props.maxSize}
|
|
493
|
+
multiple
|
|
494
|
+
accept={this.props.types}
|
|
495
|
+
onDrop={this.onDrop}
|
|
496
|
+
>
|
|
497
|
+
<p>
|
|
498
|
+
Drop image/s here <br />
|
|
499
|
+
or click to upload <br />
|
|
500
|
+
<b className="font--small">
|
|
501
|
+
Max. {this.props.maxFiles} designs per school
|
|
502
|
+
</b>
|
|
503
|
+
</p>
|
|
504
|
+
<p className="cross">+</p>
|
|
505
|
+
</Dropzone>
|
|
506
|
+
</label>
|
|
507
|
+
: <span class="branch-1 cbranch-no" title="branch not covered" >null}</span>
|
|
508
|
+
</div>
|
|
509
|
+
</section>
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
FileUp.propTypes = {
|
|
515
|
+
maxFiles: propTypes.number.isRequired,
|
|
516
|
+
maxSize: propTypes.number.isRequired,
|
|
517
|
+
onChange: propTypes.func.isRequired,
|
|
518
|
+
types: propTypes.arrayOf(propTypes.string).isRequired,
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
export { default as S3FileUploadService } from './src/service/S3FileUploadService';
|
|
522
|
+
|
|
523
|
+
export default FileUp;
|
|
524
|
+
</pre></td></tr>
|
|
525
|
+
</table></pre>
|
|
526
|
+
<div class='push'></div><!-- for sticky footer -->
|
|
527
|
+
</div><!-- /wrapper -->
|
|
528
|
+
<div class='footer quiet pad2 space-top1 center small'>
|
|
529
|
+
Code coverage
|
|
530
|
+
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Tue Nov 01 2022 13:40:05 GMT+0000 (Greenwich Mean Time)
|
|
531
|
+
</div>
|
|
532
|
+
</div>
|
|
533
|
+
<script src="../../../prettify.js"></script>
|
|
534
|
+
<script>
|
|
535
|
+
window.onload = function () {
|
|
536
|
+
if (typeof prettyPrint === 'function') {
|
|
537
|
+
prettyPrint();
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
</script>
|
|
541
|
+
<script src="../../../sorter.js"></script>
|
|
542
|
+
</body>
|
|
543
|
+
</html>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>Code coverage report for src/components/FileUp</title>
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<link rel="stylesheet" href="../../../prettify.css" />
|
|
7
|
+
<link rel="stylesheet" href="../../../base.css" />
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
9
|
+
<style type='text/css'>
|
|
10
|
+
.coverage-summary .sorter {
|
|
11
|
+
background-image: url(../../../sort-arrow-sprite.png);
|
|
12
|
+
}
|
|
13
|
+
</style>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div class='wrapper'>
|
|
17
|
+
<div class='pad1'>
|
|
18
|
+
<h1>
|
|
19
|
+
<a href="../../../index.html">All files</a> src/components/FileUp
|
|
20
|
+
</h1>
|
|
21
|
+
<div class='clearfix'>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<div class='status-line low'></div>
|
|
25
|
+
<div class="pad1">
|
|
26
|
+
<table class="coverage-summary">
|
|
27
|
+
<thead>
|
|
28
|
+
<tr>
|
|
29
|
+
<th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
|
|
30
|
+
<th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
|
|
31
|
+
<th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
|
|
32
|
+
<th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
33
|
+
<th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
|
|
34
|
+
<th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
35
|
+
<th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
|
|
36
|
+
<th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
37
|
+
<th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
|
|
38
|
+
<th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
|
|
39
|
+
</tr>
|
|
40
|
+
</thead>
|
|
41
|
+
<tbody><tr>
|
|
42
|
+
<td class="file low" data-value="FileUp.js"><a href="FileUp.js.html">FileUp.js</a></td>
|
|
43
|
+
<td data-value="" class="pic low"><div class="chart"><div class="cover-fill" style="width: 0%;"></div><div class="cover-empty" style="width:100%;"></div></div></td>
|
|
44
|
+
<td data-value="" class="pct low">%</td>
|
|
45
|
+
<td data-value="" class="abs low">/</td>
|
|
46
|
+
<td data-value="" class="pct low">%</td>
|
|
47
|
+
<td data-value="" class="abs low">/</td>
|
|
48
|
+
<td data-value="" class="pct low">%</td>
|
|
49
|
+
<td data-value="" class="abs low">/</td>
|
|
50
|
+
<td data-value="" class="pct low">%</td>
|
|
51
|
+
<td data-value="" class="abs low">/</td>
|
|
52
|
+
</tr>
|
|
53
|
+
|
|
54
|
+
</tbody>
|
|
55
|
+
</table>
|
|
56
|
+
</div><div class='push'></div><!-- for sticky footer -->
|
|
57
|
+
</div><!-- /wrapper -->
|
|
58
|
+
<div class='footer quiet pad2 space-top1 center small'>
|
|
59
|
+
Code coverage
|
|
60
|
+
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Tue Nov 01 2022 13:40:05 GMT+0000 (Greenwich Mean Time)
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
<script src="../../../prettify.js"></script>
|
|
64
|
+
<script>
|
|
65
|
+
window.onload = function () {
|
|
66
|
+
if (typeof prettyPrint === 'function') {
|
|
67
|
+
prettyPrint();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
</script>
|
|
71
|
+
<script src="../../../sorter.js"></script>
|
|
72
|
+
</body>
|
|
73
|
+
</html>
|