Skip to content

Commit 255747d

Browse files
committed
Merge branch 't/13171' into major
2 parents 1f188a0 + ec1b135 commit 255747d

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

tests/plugins/uploadwidget/manual/_helpers/xhrerror.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,31 @@
77

88
// Mock the real XMLHttpRequest so the upload test may show the effect of an error during upload.
99

10+
window.FormData = function() {
11+
var total, filename;
12+
return {
13+
append: function( name, file, filename ) {
14+
total = file.size;
15+
filename = filename;
16+
},
17+
getTotal: function() {
18+
return total;
19+
},
20+
getFileName: function() {
21+
return filename;
22+
}
23+
};
24+
};
25+
1026
window.XMLHttpRequest = function() {
1127
return {
1228
open: function() {},
1329

14-
send: function() {
30+
send: function( formData ) {
1531
// Total file size.
16-
var loaded = 0,
17-
step = 10,
32+
var total = formData.getTotal(),
33+
loaded = 0,
34+
step = Math.round( total / 10 ),
1835
onprogress = this.onprogress,
1936
onerror = this.onerror,
2037
interval;

tests/plugins/uploadwidget/manual/error.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ This test emulates an error during upload. When upload hits 50% an error occurs.
77

88
* Drop an image.
99
* Check if `upload widget` is displayed.
10-
* Check if image is removed after it reaches 50% of progress and no artifacts left.
10+
* Check if image is removed when it reaches 50% of progress and no artifacts left.
1111
* Check if you see a message about the error.

0 commit comments

Comments
 (0)