Skip to content

Commit c11f5ec

Browse files
committed
Added the download files and fixed the tests for travis.
1 parent c181f17 commit c11f5ec

8 files changed

+32
-24
lines changed

downloads/dropzone-amd-module.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -971,12 +971,15 @@ Emitter.prototype.hasListeners = function(event){
971971
parallelUploads = this.options.parallelUploads;
972972
processingLength = this.getUploadingFiles().length;
973973
i = processingLength;
974+
if (processingLength >= parallelUploads) {
975+
return;
976+
}
974977
queuedFiles = this.getQueuedFiles();
975978
if (!(queuedFiles.length > 0)) {
976979
return;
977980
}
978981
if (this.options.uploadMultiple) {
979-
return this.processFiles(queuedFiles.slice(0, parallelUploads));
982+
return this.processFiles(queuedFiles.slice(0, parallelUploads - processingLength));
980983
} else {
981984
while (i < parallelUploads) {
982985
if (!queuedFiles.length) {

downloads/dropzone-amd-module.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

downloads/dropzone.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1169,12 +1169,15 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
11691169
parallelUploads = this.options.parallelUploads;
11701170
processingLength = this.getUploadingFiles().length;
11711171
i = processingLength;
1172+
if (processingLength >= parallelUploads) {
1173+
return;
1174+
}
11721175
queuedFiles = this.getQueuedFiles();
11731176
if (!(queuedFiles.length > 0)) {
11741177
return;
11751178
}
11761179
if (this.options.uploadMultiple) {
1177-
return this.processFiles(queuedFiles.slice(0, parallelUploads));
1180+
return this.processFiles(queuedFiles.slice(0, parallelUploads - processingLength));
11781181
} else {
11791182
while (i < parallelUploads) {
11801183
if (!queuedFiles.length) {
@@ -1711,7 +1714,6 @@ require.register("dropzone/lib/dropzone.js", function(exports, require, module){
17111714
});
17121715
require.alias("component-emitter/index.js", "dropzone/deps/emitter/index.js");
17131716
require.alias("component-emitter/index.js", "emitter/index.js");
1714-
17151717
if (typeof exports == "object") {
17161718
module.exports = require("dropzone");
17171719
} else if (typeof define == "function" && define.amd) {

downloads/dropzone.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/dropzone.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -810,12 +810,15 @@
810810
parallelUploads = this.options.parallelUploads;
811811
processingLength = this.getUploadingFiles().length;
812812
i = processingLength;
813+
if (processingLength >= parallelUploads) {
814+
return;
815+
}
813816
queuedFiles = this.getQueuedFiles();
814817
if (!(queuedFiles.length > 0)) {
815818
return;
816819
}
817820
if (this.options.uploadMultiple) {
818-
return this.processFiles(queuedFiles.slice(0, parallelUploads));
821+
return this.processFiles(queuedFiles.slice(0, parallelUploads - processingLength));
819822
} else {
820823
while (i < parallelUploads) {
821824
if (!queuedFiles.length) {

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
"grunt-component-build": "*",
4040
"grunt-contrib-copy": "*",
4141
"grunt-contrib-watch": "*",
42-
"mocha-phantomjs": "2.x",
43-
"mocha": "1.9",
44-
"sinon": "*",
45-
"chai": "*"
42+
"mocha-phantomjs": "3.1.x",
43+
"mocha": "1.12.x",
44+
"sinon": "1.7.x",
45+
"chai": "1.7.x"
4646
}
4747

4848
}

test/test.coffee

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ describe "Dropzone", ->
99
type: "text/html"
1010

1111

12+
xhr = null
13+
beforeEach -> xhr = sinon.useFakeXMLHttpRequest()
14+
15+
1216
describe "static functions", ->
1317

1418
describe "Dropzone.createElement()", ->
@@ -409,10 +413,8 @@ describe "Dropzone", ->
409413

410414
element = null
411415
dropzone = null
412-
xhr = null
413416
requests = null
414417
beforeEach ->
415-
xhr = sinon.useFakeXMLHttpRequest()
416418
requests = [ ]
417419
xhr.onCreate = (xhr) -> requests.push xhr
418420

@@ -769,7 +771,7 @@ describe "Dropzone", ->
769771
mock3 = getMockFile()
770772
mock4 = getMockFile()
771773

772-
dropzone.options.accept = (file, done) -> file.done = done
774+
dropzone.options.accept = (file, _done) -> file.done = _done
773775
dropzone.uploadFile = ->
774776

775777
dropzone.addFile mock1
@@ -886,13 +888,11 @@ describe "Dropzone", ->
886888
, 10
887889

888890
describe "uploadFiles()", ->
889-
xhr = null
890891
requests = null
891892

892893

893894

894895
beforeEach ->
895-
xhr = sinon.useFakeXMLHttpRequest()
896896
requests = [ ]
897897

898898
xhr.onCreate = (xhr) -> requests.push xhr

test/test.js

+9-9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)