Commit graph

1186 commits

Author SHA1 Message Date
Artur Paikin
ebf7f60e6a Merge pull request #354 from gavboulton/plugin-tests
Add Plugin class unit tests
2017-09-20 16:03:19 -04:00
Gavin Boulton
b3371bacc0 Add Plugin class unit tests
The `replaceTargetContent` option wasn't being set correctly, this has been updated.

The `mount` method uses a `render` method (which is not set in the Plugin) so I've had to manually add this to the instance for the tests.
2017-09-20 11:31:35 +01:00
Renée Kooi
08e11d9fc5
restore: Clean up blobs that are not related to a file in state
This patch makes sure only blobs that are referenced by the localStorage
state are actually restored. Blobs that are returned from the persistent
serviceWorker or IndexedDB stores, but aren't referenced by the `files`
state object restored from localStorage, will be deleted.

Should fix #348.
Part of #342, but we need to do more before we can call that fixed :)
2017-09-20 10:49:55 +02:00
Artur Paikin
685f701d0c Merge pull request #351 from transloadit/fix/restorefiles-with-id
restore: Fix restorefiles with id
2017-09-19 12:16:17 -04:00
Artur Paikin
674fe15f31 fix state update event 2017-09-18 18:24:34 -04:00
Artur Paikin
11002c8d43 Merge pull request #341 from sunil-shrestha/fix/clearCurrentUploads
set the newState before emiting "core:state-update" .
2017-09-18 18:04:24 -04:00
Artur Paikin
16734976a7 We don’t need to repeat id here, since the key is id?
@goto-bus-stop I might be missing something though
2017-09-18 17:11:21 -04:00
Artur Paikin
ef1c3306c6 Flatten payload params 2017-09-18 17:09:47 -04:00
Artur Paikin
a4668d4f96 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	src/core/Core.js
#	src/plugins/Dashboard/index.js
2017-09-15 23:56:18 -04:00
Artur Paikin
7b7aa7d7d9 add type.mime to tests 2017-09-14 22:50:14 -04:00
Artur Paikin
4a85a4d1e0 refactor a little, add file.type.mime (before the migration to mime entirely) add comments 2017-09-14 22:39:21 -04:00
Artur Paikin
1f8a369f4f separate checkMinNumberOfFiles method 2017-09-14 13:20:45 -04:00
Artur Paikin
829713851e Adjust checkMinNumberOfFiles
Fixes #344
2017-09-14 12:51:19 -04:00
Artur Paikin
4e808ca3d2 add aria-hidden to all icons for accessibility, remove console.log 2017-09-14 12:01:19 -04:00
Artur Paikin
0eb2448a3d Fix calculateTotalProgress - NaN 2017-09-13 18:50:41 -04:00
Sunil Shrestha
2c951a884d set the newState before emiting "core:state-update" . 2017-09-13 14:40:33 +03:00
Artur Paikin
016557e246 Merge pull request #330 from transloadit/fix/fileID
Better `generateFileID`
2017-09-12 11:10:29 -04:00
Artur Paikin
0e1a4b51a4 Merge pull request #335 from richardwillars/core-tests
[WIP] Remaining tests for src/core.js
2017-09-12 11:09:16 -04:00
Artur Paikin
e69151ca0c Merge pull request #319 from richardwillars/isOnline
Tell Uppy to be offline
2017-09-12 10:59:20 -04:00
Richard Willars
050ecbfa1e Adds tests for checkRestrictions 2017-09-12 15:48:03 +01:00
Richard Willars
abbaed88cd Test for createUpload 2017-09-12 10:50:12 +01:00
Richard Willars
979be04540 Remove upload test 2017-09-12 10:10:21 +01:00
Richard Willars
504a6977ac Adds tests for info messages (and fixes hideInfo method) 2017-09-12 09:09:25 +01:00
Artur Paikin
df659c5417 Merge pull request #328 from transloadit/chore/dashboard
Dashboard: show()/hide()/isOpen()
2017-09-11 21:16:56 -04:00
Artur Paikin
91ec5dbdd6 refactor: openModal, closeModal, isModalOpen 2017-09-11 14:09:44 -04:00
Artur Paikin
1cdd617b8c return an array always, even with a single item 2017-09-11 10:33:52 -04:00
Richard Willars
6ecaad1bc6 Rename isOnline with updateOnlineStatus and removed params
isOnline renamed to updateOnlineStatus and removes params

updateOnlineStatus default to true

Improved the window.navigator.onLine check

Adds tests for updateOnlineStatus

Removes debug

Fixes isTouchDevice test

File cleanup

Simplifies mock for window.navigator.onLine
2017-09-11 15:01:29 +01:00
Artur Paikin
a08319fde5 lastModified is a number 2017-09-11 09:59:19 -04:00
Artur Paikin
981a331c10 allow “selector” to be a DOM element in findAllDOMElements too 2017-09-11 09:45:43 -04:00
Renée Kooi
383aa85025 Merge pull request #323 from goto-bus-stop/rm-upload-complete
core: Remove `core:upload-complete` event.
2017-09-11 09:59:30 +02:00
Artur Paikin
6b6ce35927 add findDOMElements that always returns an array of DOM elements 2017-09-10 21:35:10 -04:00
Artur Paikin
80636d125c fix tests
I unfortunately can’t seem to understand this test: `should execute all
the postprocessors when uploading a file` in Core.test.js:
6bee4f427f
eb771774b/src/core/Core.test.js#L388

@richardwillars could you please help explain why the fileID is used
there and how, and if it’s wrong to change it the way I did here?
2017-09-10 20:53:18 -04:00
Artur Paikin
bd8345a166 Better generateFileID
Fixes #317
2017-09-10 19:56:31 -04:00
Artur Paikin
1e2a722b08 fix FileItem source icon position and copy 2017-09-10 14:24:20 -04:00
Artur Paikin
1c2e4425c8 remove unused styles 2017-09-10 14:12:36 -04:00
Artur Paikin
fbf53b4576 Merge pull request #321 from goto-bus-stop/chore/unmagic
transloadit: remove `this.state` getter
2017-09-09 19:16:33 -04:00
Artur Paikin
5d30474c43 Merge pull request #310 from richardwillars/jest-tests
Jest tests
2017-09-09 19:14:18 -04:00
Renée Kooi
d4e5daa630
xhrupload,tus: Use promise-settle 2017-09-09 14:08:41 +02:00
Artur Paikin
c77c6a103d hideModal/showModal --> show/hide, isOpen, DashboardUI --> Dashboard 2017-09-08 15:24:30 -04:00
Artur Paikin
7dfae9d24c support multiple elements in findDOMElement
@goto-bus-stop potential danger point. introduced to support multiple
dashboard open triggers #326

Maybe we should always return an array and just use the first element
where multiple elements don’t make sense
2017-09-08 15:23:44 -04:00
Artur Paikin
83f514232e bind info 2017-09-08 15:21:48 -04:00
Artur Paikin
6b08aef724 word-break: break-all
#192
2017-09-08 13:47:00 -04:00
Rich Willars
540c02b6b0 Add jest tests
Adds tests for src/core/Utils

Ports translator tests to jest

Adds tests for core/index

Added code coverage report

Adds tests for core/UppySocket

Adds tests to src/core and cleanup of test directory

Switched from import to require as the project supports node v4

Runs tests using Babel for backwards compatibilty

Adds src/core state tests

Adds src/core reset & close tests

Updates stagnant snapshot

Adds tests for preprocessors and postprocessors in src/core/Core.js

Adds tests for uploaders and metadata in src/core/Core

Adds tests for adding and removing files in src/core/Core

Adds test for getFile
2017-09-08 17:18:58 +01:00
Renée Kooi
2ef0f04ac2
core: Remove core:upload-complete event.
XHRUpload and Tus were relying on `core:upload-complete` to determine
when their uploads had all finished, but `core:upload-complete` could
fire before all XHR `onload` handlers were called. Then, because
XHRUpload and Tus would resolve their `handleUpload` promises at that
point, the `core:success` event could fire *before* all
`core:upload-success` events had fired, and before the plugins properly
handled responses. In particular, some files may not have `.uploadURL`
properties when `core:success` is fired:

https://community.transloadit.com/t/unable-to-get-to-work-the-awss3-plugin/14477/16

I think, that the XHR `onprogress` event would fire first at 100%, and
then the `onload` handler fired at some point later (after the response
was parsed or whatever the browser does to it). This could cause the
`core:upload-complete` event to fire before responses were handled by
Uppy.

The XHRUpload and Tus plugins now use the Promises that they were
already creating to wait for uploads to complete. This way they will
always have handled responses before handing over control to
postprocessors and before the `core:success` event is fired.

Since `core:upload-complete` is now unused, I just removed it for now.
2017-09-08 14:28:13 +02:00
Renée Kooi
2966c53668
core: fix comment indents 2017-09-08 13:51:40 +02:00
Renée Kooi
e5d83ed2f2
transloadit,webcam: Rename updateStatesetPluginState 2017-09-08 13:43:02 +02:00
Renée Kooi
c9eacb8a8d
transloadit: remove this.state getter 2017-09-07 20:26:41 +02:00
Renée Kooi
8a4cfed360 Merge pull request #316 from goto-bus-stop/promise-resolve
Handle sync returns and throws in possibly-async function options
2017-09-07 14:50:20 +02:00
Renée Kooi
14ac43a63a
tus: remove unused default option 2017-09-06 14:50:37 +02:00
Renée Kooi
dee1f69591
core: remove unnecessary instanceof check
This function will never be an instance of the `Uppy` class.
2017-09-05 19:19:30 +02:00