File tree Expand file tree Collapse file tree 2 files changed +21
-4
lines changed
tests/plugins/uploadwidget/manual Expand file tree Collapse file tree 2 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 7
7
8
8
// Mock the real XMLHttpRequest so the upload test may show the effect of an error during upload.
9
9
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
+
10
26
window . XMLHttpRequest = function ( ) {
11
27
return {
12
28
open : function ( ) { } ,
13
29
14
- send : function ( ) {
30
+ send : function ( formData ) {
15
31
// Total file size.
16
- var loaded = 0 ,
17
- step = 10 ,
32
+ var total = formData . getTotal ( ) ,
33
+ loaded = 0 ,
34
+ step = Math . round ( total / 10 ) ,
18
35
onprogress = this . onprogress ,
19
36
onerror = this . onerror ,
20
37
interval ;
Original file line number Diff line number Diff line change @@ -7,5 +7,5 @@ This test emulates an error during upload. When upload hits 50% an error occurs.
7
7
8
8
* Drop an image.
9
9
* 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.
11
11
* Check if you see a message about the error.
You can’t perform that action at this time.
0 commit comments