This repository has been archived by the owner on Nov 20, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feature: adding setStatus to the public api list #1739
Closed
CoolGoose
wants to merge
4
commits into
FineUploader:develop
from
CoolGoose:feature/public-setStatus
Closed
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* globals describe, beforeEach, qq, qqtest, assert, helpme, it */ | ||
|
||
describe("set-status.js", function () { | ||
"use strict"; | ||
|
||
var testUploadEndpoint = "/test/upload", | ||
fileTestHelper = helpme.setupFileTests(); | ||
|
||
var initialFiles = [{ | ||
name: "left.jpg", | ||
uuid: "e109af57-848b-4c2a-bca8-051374d01db1" | ||
}, { | ||
name: "right.jpg", | ||
uuid: "949d16c3-727a-4c3c-8c0f-23404dcd6f3b" | ||
}]; | ||
|
||
it("testing status change of DELETED with initialFiles", function () { | ||
var uploader = new qq.FineUploaderBasic(); | ||
uploader.addInitialFiles(initialFiles); | ||
|
||
var uploaderFiles = uploader.getUploads(); | ||
var file = uploaderFiles[0]; | ||
|
||
uploader.setStatus(file.id, qq.status.DELETED); | ||
|
||
uploaderFiles = uploader.getUploads(); | ||
file = uploaderFiles[0]; | ||
|
||
assert.equal(qq.status.DELETED, file.status); | ||
}); | ||
|
||
it("testing status change of DELETE_FAILED with initialFiles", function () { | ||
var uploader = new qq.FineUploaderBasic(); | ||
uploader.addInitialFiles(initialFiles); | ||
|
||
var uploaderFiles = uploader.getUploads(); | ||
var file = uploaderFiles[1]; | ||
|
||
uploader.setStatus(file.id, qq.status.DELETE_FAILED); | ||
|
||
uploaderFiles = uploader.getUploads(); | ||
file = uploaderFiles[1]; | ||
|
||
assert.equal(qq.status.DELETE_FAILED, file.status); | ||
}); | ||
|
||
it("testing status change of DELETED with mock uploader", function () { | ||
var uploader = new qq.FineUploaderBasic({ | ||
autoUpload: true, | ||
request: { | ||
endpoint: testUploadEndpoint | ||
} | ||
}); | ||
|
||
qqtest.downloadFileAsBlob("up.jpg", "image/jpeg").then(function(blob) { | ||
fileTestHelper.mockXhr(); | ||
|
||
uploader.addFiles({name: "test", blob: blob}); | ||
uploader.uploadStoredFiles(); | ||
fileTestHelper.getRequests()[0].respond(201, null, JSON.stringify({success: true})); | ||
}); | ||
|
||
var uploaderFiles = uploader.getUploads(); | ||
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
Sorry, something went wrong. |
||
var file = uploaderFiles[0]; | ||
|
||
uploader.setStatus(file.id, qq.status.DELETED); | ||
|
||
uploaderFiles = uploader.getUploads(); | ||
file = uploaderFiles[0]; | ||
|
||
assert.equal(qq.status.DELETED, file.status); | ||
}); | ||
|
||
it("testing status change of DELETED with mock uploader", function () { | ||
var uploader = new qq.FineUploaderBasic({ | ||
autoUpload: true, | ||
request: { | ||
endpoint: testUploadEndpoint | ||
} | ||
}); | ||
|
||
qqtest.downloadFileAsBlob("up.jpg", "image/jpeg").then(function(blob) { | ||
fileTestHelper.mockXhr(); | ||
|
||
uploader.addFiles({name: "test", blob: blob}); | ||
uploader.uploadStoredFiles(); | ||
fileTestHelper.getRequests()[0].respond(201, null, JSON.stringify({success: true})); | ||
}); | ||
|
||
var uploaderFiles = uploader.getUploads(); | ||
var file = uploaderFiles[0]; | ||
|
||
uploader.setStatus(file.id, qq.status.DELETE_FAILED); | ||
|
||
uploaderFiles = uploader.getUploads(); | ||
file = uploaderFiles[0]; | ||
|
||
assert.equal(qq.status.DELETE_FAILED, file.status); | ||
}); | ||
|
||
}); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as spam.
Sorry, something went wrong.