card-mod-machines 0.11.3 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/file/all_script_machine_output/file.js +72 -70
  3. data/file/all_style_machine_output/file.css +2 -2
  4. metadata +12 -88
  5. data/vendor/jquery_file_upload/CONTRIBUTING.md +0 -15
  6. data/vendor/jquery_file_upload/LICENSE.txt +0 -21
  7. data/vendor/jquery_file_upload/README.md +0 -107
  8. data/vendor/jquery_file_upload/angularjs.html +0 -211
  9. data/vendor/jquery_file_upload/basic-plus.html +0 -226
  10. data/vendor/jquery_file_upload/basic.html +0 -136
  11. data/vendor/jquery_file_upload/bower-version-update.js +0 -16
  12. data/vendor/jquery_file_upload/bower.json +0 -64
  13. data/vendor/jquery_file_upload/cors/postmessage.html +0 -75
  14. data/vendor/jquery_file_upload/cors/result.html +0 -24
  15. data/vendor/jquery_file_upload/css/jquery-ui-demo-ie8.css +0 -21
  16. data/vendor/jquery_file_upload/css/jquery-ui-demo.css +0 -67
  17. data/vendor/jquery_file_upload/css/jquery.fileupload-noscript.css +0 -22
  18. data/vendor/jquery_file_upload/css/jquery.fileupload-ui-noscript.css +0 -17
  19. data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +0 -57
  20. data/vendor/jquery_file_upload/css/jquery.fileupload.css +0 -37
  21. data/vendor/jquery_file_upload/css/style.css +0 -15
  22. data/vendor/jquery_file_upload/img/loading.gif +0 -0
  23. data/vendor/jquery_file_upload/img/progressbar.gif +0 -0
  24. data/vendor/jquery_file_upload/index.html +0 -255
  25. data/vendor/jquery_file_upload/jquery-ui.html +0 -252
  26. data/vendor/jquery_file_upload/js/app.js +0 -101
  27. data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +0 -126
  28. data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +0 -89
  29. data/vendor/jquery_file_upload/js/jquery.fileupload-angular.js +0 -437
  30. data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +0 -113
  31. data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +0 -326
  32. data/vendor/jquery_file_upload/js/jquery.fileupload-jquery-ui.js +0 -161
  33. data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +0 -178
  34. data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +0 -714
  35. data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +0 -125
  36. data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +0 -113
  37. data/vendor/jquery_file_upload/js/jquery.fileupload.js +0 -1486
  38. data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +0 -224
  39. data/vendor/jquery_file_upload/js/main.js +0 -75
  40. data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +0 -748
  41. data/vendor/jquery_file_upload/package.json +0 -55
  42. data/vendor/jquery_file_upload/server/gae-go/app.yaml +0 -12
  43. data/vendor/jquery_file_upload/server/gae-go/app/main.go +0 -361
  44. data/vendor/jquery_file_upload/server/gae-go/static/favicon.ico +0 -0
  45. data/vendor/jquery_file_upload/server/gae-go/static/robots.txt +0 -2
  46. data/vendor/jquery_file_upload/server/gae-python/app.yaml +0 -17
  47. data/vendor/jquery_file_upload/server/gae-python/main.py +0 -204
  48. data/vendor/jquery_file_upload/server/gae-python/static/favicon.ico +0 -0
  49. data/vendor/jquery_file_upload/server/gae-python/static/robots.txt +0 -2
  50. data/vendor/jquery_file_upload/server/php/Dockerfile +0 -38
  51. data/vendor/jquery_file_upload/server/php/UploadHandler.php +0 -1411
  52. data/vendor/jquery_file_upload/server/php/docker-compose.yml +0 -9
  53. data/vendor/jquery_file_upload/server/php/index.php +0 -15
  54. data/vendor/jquery_file_upload/test/index.html +0 -172
  55. data/vendor/jquery_file_upload/test/test.js +0 -1292
  56. data/vendor/jquery_rails/CHANGELOG.md +0 -359
  57. data/vendor/jquery_rails/CONTRIBUTING.md +0 -132
  58. data/vendor/jquery_rails/Gemfile +0 -22
  59. data/vendor/jquery_rails/MIT-LICENSE +0 -21
  60. data/vendor/jquery_rails/README.md +0 -75
  61. data/vendor/jquery_rails/Rakefile +0 -59
  62. data/vendor/jquery_rails/VERSIONS.md +0 -62
  63. data/vendor/jquery_rails/jquery-rails.gemspec +0 -26
  64. data/vendor/jquery_rails/lib/jquery-rails.rb +0 -1
  65. data/vendor/jquery_rails/lib/jquery/assert_select.rb +0 -149
  66. data/vendor/jquery_rails/lib/jquery/rails.rb +0 -8
  67. data/vendor/jquery_rails/lib/jquery/rails/engine.rb +0 -6
  68. data/vendor/jquery_rails/lib/jquery/rails/version.rb +0 -9
  69. data/vendor/jquery_rails/test/assert_select_jquery_test.rb +0 -85
  70. data/vendor/jquery_rails/test/test_helper.rb +0 -6
  71. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.js +0 -11008
  72. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.js +0 -5
  73. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.map +0 -1
  74. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.js +0 -9814
  75. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.js +0 -4
  76. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.map +0 -1
  77. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.js +0 -10364
  78. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.js +0 -2
  79. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.map +0 -1
  80. data/vendor/jquery_rails/vendor/assets/javascripts/jquery_ujs.js +0 -555
@@ -1,9 +0,0 @@
1
- version: '2.3'
2
- services:
3
- apache:
4
- build: ./
5
- network_mode: bridge
6
- ports:
7
- - "80:80"
8
- volumes:
9
- - "../../:/var/www/html"
@@ -1,15 +0,0 @@
1
- <?php
2
- /*
3
- * jQuery File Upload Plugin PHP Example
4
- * https://github.com/blueimp/jQuery-File-Upload
5
- *
6
- * Copyright 2010, Sebastian Tschan
7
- * https://blueimp.net
8
- *
9
- * Licensed under the MIT license:
10
- * https://opensource.org/licenses/MIT
11
- */
12
-
13
- error_reporting(E_ALL | E_STRICT);
14
- require('UploadHandler.php');
15
- $upload_handler = new UploadHandler();
@@ -1,172 +0,0 @@
1
- <!DOCTYPE HTML>
2
- <!--
3
- /*
4
- * jQuery File Upload Plugin Test
5
- * https://github.com/blueimp/jQuery-File-Upload
6
- *
7
- * Copyright 2010, Sebastian Tschan
8
- * https://blueimp.net
9
- *
10
- * Licensed under the MIT license:
11
- * https://opensource.org/licenses/MIT
12
- */
13
- -->
14
- <html lang="en">
15
- <head>
16
- <!-- Force latest IE rendering engine or ChromeFrame if installed -->
17
- <!--[if IE]>
18
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
19
- <![endif]-->
20
- <meta charset="utf-8">
21
- <title>jQuery File Upload Plugin Test</title>
22
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
23
- <link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-1.23.1.css">
24
- </head>
25
- <body>
26
- <h1 id="qunit-header">jQuery File Upload Plugin Test</h1>
27
- <h2 id="qunit-banner"></h2>
28
- <div id="qunit-testrunner-toolbar"></div>
29
- <h2 id="qunit-userAgent"></h2>
30
- <ol id="qunit-tests"></ol>
31
- <div id="qunit-fixture">
32
- <!-- The file upload form used as target for the file upload widget -->
33
- <form id="fileupload" action="../server/php/" method="POST" enctype="multipart/form-data">
34
- <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload -->
35
- <div class="row fileupload-buttonbar">
36
- <div class="col-lg-7">
37
- <!-- The fileinput-button span is used to style the file input field as button -->
38
- <span class="btn btn-success fileinput-button">
39
- <i class="icon-plus icon-white"></i>
40
- <span>Add files...</span>
41
- <input type="file" name="files[]" multiple>
42
- </span>
43
- <button type="submit" class="btn btn-primary start">
44
- <i class="icon-upload icon-white"></i>
45
- <span>Start upload</span>
46
- </button>
47
- <button type="reset" class="btn btn-warning cancel">
48
- <i class="icon-ban-circle icon-white"></i>
49
- <span>Cancel upload</span>
50
- </button>
51
- <button type="button" class="btn btn-danger delete">
52
- <i class="icon-trash icon-white"></i>
53
- <span>Delete</span>
54
- </button>
55
- <input type="checkbox" class="toggle">
56
- <!-- The global file processing state -->
57
- <span class="fileupload-process"></span>
58
- </div>
59
- <!-- The global progress state -->
60
- <div class="col-lg-5 fileupload-progress">
61
- <!-- The global progress bar -->
62
- <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100">
63
- <div class="progress-bar progress-bar-success" style="width:0%;"></div>
64
- </div>
65
- <!-- The extended global progress state -->
66
- <div class="progress-extended">&nbsp;</div>
67
- </div>
68
- </div>
69
- <!-- The table listing the files available for upload/download -->
70
- <table role="presentation" class="table table-striped"><tbody class="files"></tbody></table>
71
- </form>
72
- </div>
73
- <!-- The template to display files available for upload -->
74
- <script id="template-upload" type="text/x-tmpl">
75
- {% for (var i=0, file; file=o.files[i]; i++) { %}
76
- <tr class="template-upload">
77
- <td>
78
- <span class="preview"></span>
79
- </td>
80
- <td>
81
- <p class="name">{%=file.name%}</p>
82
- <strong class="error text-danger"></strong>
83
- </td>
84
- <td>
85
- <p class="size">Processing...</p>
86
- <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div>
87
- </td>
88
- <td>
89
- {% if (!i && !o.options.autoUpload) { %}
90
- <button class="btn btn-primary start" disabled>
91
- <i class="glyphicon glyphicon-upload"></i>
92
- <span>Start</span>
93
- </button>
94
- {% } %}
95
- {% if (!i) { %}
96
- <button class="btn btn-warning cancel">
97
- <i class="glyphicon glyphicon-ban-circle"></i>
98
- <span>Cancel</span>
99
- </button>
100
- {% } %}
101
- </td>
102
- </tr>
103
- {% } %}
104
- </script>
105
- <!-- The template to display files available for download -->
106
- <script id="template-download" type="text/x-tmpl">
107
- {% for (var i=0, file; file=o.files[i]; i++) { %}
108
- <tr class="template-download">
109
- <td>
110
- <span class="preview">
111
- {% if (file.thumbnailUrl) { %}
112
- <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
113
- {% } %}
114
- </span>
115
- </td>
116
- <td>
117
- <p class="name">
118
- {% if (file.url) { %}
119
- <a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%}>{%=file.name%}</a>
120
- {% } else { %}
121
- <span>{%=file.name%}</span>
122
- {% } %}
123
- </p>
124
- {% if (file.error) { %}
125
- <div><span class="label label-danger">Error</span> {%=file.error%}</div>
126
- {% } %}
127
- </td>
128
- <td>
129
- <span class="size">{%=o.formatFileSize(file.size)%}</span>
130
- </td>
131
- <td>
132
- {% if (file.deleteUrl) { %}
133
- <button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}"{% if (file.deleteWithCredentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
134
- <i class="glyphicon glyphicon-trash"></i>
135
- <span>Delete</span>
136
- </button>
137
- <input type="checkbox" name="delete" value="1" class="toggle">
138
- {% } else { %}
139
- <button class="btn btn-warning cancel">
140
- <i class="glyphicon glyphicon-ban-circle"></i>
141
- <span>Cancel</span>
142
- </button>
143
- {% } %}
144
- </td>
145
- </tr>
146
- {% } %}
147
- </script>
148
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
149
- <script src="../js/vendor/jquery.ui.widget.js"></script>
150
- <script src="https://blueimp.github.io/JavaScript-Templates/js/tmpl.min.js"></script>
151
- <script src="https://blueimp.github.io/JavaScript-Load-Image/js/load-image.all.min.js"></script>
152
- <script src="https://blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script>
153
- <script src="../js/jquery.iframe-transport.js"></script>
154
- <script src="../js/jquery.fileupload.js"></script>
155
- <script>
156
- /* global window, $ */
157
- window.testBasicWidget = $.blueimp.fileupload;
158
- </script>
159
- <script src="../js/jquery.fileupload-process.js"></script>
160
- <script src="../js/jquery.fileupload-image.js"></script>
161
- <script src="../js/jquery.fileupload-audio.js"></script>
162
- <script src="../js/jquery.fileupload-video.js"></script>
163
- <script src="../js/jquery.fileupload-validate.js"></script>
164
- <script src="../js/jquery.fileupload-ui.js"></script>
165
- <script>
166
- /* global window, $ */
167
- window.testUIWidget = $.blueimp.fileupload;
168
- </script>
169
- <script src="https://code.jquery.com/qunit/qunit-1.23.1.js"></script>
170
- <script src="test.js"></script>
171
- </body>
172
- </html>
@@ -1,1292 +0,0 @@
1
- /*
2
- * jQuery File Upload Plugin Test
3
- * https://github.com/blueimp/jQuery-File-Upload
4
- *
5
- * Copyright 2010, Sebastian Tschan
6
- * https://blueimp.net
7
- *
8
- * Licensed under the MIT license:
9
- * https://opensource.org/licenses/MIT
10
- */
11
-
12
- /* global $, QUnit, window, document, expect, module, test, asyncTest, start, ok, strictEqual, notStrictEqual */
13
-
14
- $(function () {
15
- // jshint nomen:false
16
- 'use strict';
17
-
18
- QUnit.done = function () {
19
- // Delete all uploaded files:
20
- var url = $('#fileupload').prop('action');
21
- $.getJSON(url, function (result) {
22
- $.each(result.files, function (index, file) {
23
- $.ajax({
24
- url: url + '?file=' + encodeURIComponent(file.name),
25
- type: 'DELETE'
26
- });
27
- });
28
- });
29
- };
30
-
31
- var lifecycle = {
32
- setup: function () {
33
- // Set the .fileupload method to the basic widget method:
34
- $.widget('blueimp.fileupload', window.testBasicWidget, {});
35
- },
36
- teardown: function () {
37
- // Remove all remaining event listeners:
38
- $(document).unbind();
39
- }
40
- },
41
- lifecycleUI = {
42
- setup: function () {
43
- // Set the .fileupload method to the UI widget method:
44
- $.widget('blueimp.fileupload', window.testUIWidget, {});
45
- },
46
- teardown: function () {
47
- // Remove all remaining event listeners:
48
- $(document).unbind();
49
- }
50
- };
51
-
52
- module('Initialization', lifecycle);
53
-
54
- test('Widget initialization', function () {
55
- var fu = $('#fileupload').fileupload();
56
- ok(fu.data('blueimp-fileupload') || fu.data('fileupload'));
57
- });
58
-
59
- test('Data attribute options', function () {
60
- $('#fileupload').attr('data-url', 'http://example.org');
61
- $('#fileupload').fileupload();
62
- strictEqual(
63
- $('#fileupload').fileupload('option', 'url'),
64
- 'http://example.org'
65
- );
66
- });
67
-
68
- test('File input initialization', function () {
69
- var fu = $('#fileupload').fileupload();
70
- ok(
71
- fu.fileupload('option', 'fileInput').length,
72
- 'File input field inside of the widget'
73
- );
74
- ok(
75
- fu.fileupload('option', 'fileInput').length,
76
- 'Widget element as file input field'
77
- );
78
- });
79
-
80
- test('Drop zone initialization', function () {
81
- ok($('#fileupload').fileupload()
82
- .fileupload('option', 'dropZone').length);
83
- });
84
-
85
- test('Paste zone initialization', function () {
86
- ok($('#fileupload').fileupload({pasteZone: document})
87
- .fileupload('option', 'pasteZone').length);
88
- });
89
-
90
- test('Event listeners initialization', function () {
91
- expect(
92
- $.support.xhrFormDataFileUpload ? 4 : 1
93
- );
94
- var eo = {
95
- originalEvent: {
96
- dataTransfer: {files: [{}], types: ['Files']},
97
- clipboardData: {items: [{}]}
98
- }
99
- },
100
- fu = $('#fileupload').fileupload({
101
- pasteZone: document,
102
- dragover: function () {
103
- ok(true, 'Triggers dragover callback');
104
- return false;
105
- },
106
- drop: function () {
107
- ok(true, 'Triggers drop callback');
108
- return false;
109
- },
110
- paste: function () {
111
- ok(true, 'Triggers paste callback');
112
- return false;
113
- },
114
- change: function () {
115
- ok(true, 'Triggers change callback');
116
- return false;
117
- }
118
- }),
119
- fileInput = fu.fileupload('option', 'fileInput'),
120
- dropZone = fu.fileupload('option', 'dropZone'),
121
- pasteZone = fu.fileupload('option', 'pasteZone');
122
- fileInput.trigger($.Event('change', eo));
123
- dropZone.trigger($.Event('dragover', eo));
124
- dropZone.trigger($.Event('drop', eo));
125
- pasteZone.trigger($.Event('paste', eo));
126
- });
127
-
128
- module('API', lifecycle);
129
-
130
- test('destroy', function () {
131
- expect(4);
132
- var eo = {
133
- originalEvent: {
134
- dataTransfer: {files: [{}], types: ['Files']},
135
- clipboardData: {items: [{}]}
136
- }
137
- },
138
- options = {
139
- pasteZone: document,
140
- dragover: function () {
141
- ok(true, 'Triggers dragover callback');
142
- return false;
143
- },
144
- drop: function () {
145
- ok(true, 'Triggers drop callback');
146
- return false;
147
- },
148
- paste: function () {
149
- ok(true, 'Triggers paste callback');
150
- return false;
151
- },
152
- change: function () {
153
- ok(true, 'Triggers change callback');
154
- return false;
155
- }
156
- },
157
- fu = $('#fileupload').fileupload(options),
158
- fileInput = fu.fileupload('option', 'fileInput'),
159
- dropZone = fu.fileupload('option', 'dropZone'),
160
- pasteZone = fu.fileupload('option', 'pasteZone');
161
- dropZone.bind('dragover', options.dragover);
162
- dropZone.bind('drop', options.drop);
163
- pasteZone.bind('paste', options.paste);
164
- fileInput.bind('change', options.change);
165
- fu.fileupload('destroy');
166
- fileInput.trigger($.Event('change', eo));
167
- dropZone.trigger($.Event('dragover', eo));
168
- dropZone.trigger($.Event('drop', eo));
169
- pasteZone.trigger($.Event('paste', eo));
170
- });
171
-
172
- test('disable/enable', function () {
173
- expect(
174
- $.support.xhrFormDataFileUpload ? 4 : 1
175
- );
176
- var eo = {
177
- originalEvent: {
178
- dataTransfer: {files: [{}], types: ['Files']},
179
- clipboardData: {items: [{}]}
180
- }
181
- },
182
- fu = $('#fileupload').fileupload({
183
- pasteZone: document,
184
- dragover: function () {
185
- ok(true, 'Triggers dragover callback');
186
- return false;
187
- },
188
- drop: function () {
189
- ok(true, 'Triggers drop callback');
190
- return false;
191
- },
192
- paste: function () {
193
- ok(true, 'Triggers paste callback');
194
- return false;
195
- },
196
- change: function () {
197
- ok(true, 'Triggers change callback');
198
- return false;
199
- }
200
- }),
201
- fileInput = fu.fileupload('option', 'fileInput'),
202
- dropZone = fu.fileupload('option', 'dropZone'),
203
- pasteZone = fu.fileupload('option', 'pasteZone');
204
- fu.fileupload('disable');
205
- fileInput.trigger($.Event('change', eo));
206
- dropZone.trigger($.Event('dragover', eo));
207
- dropZone.trigger($.Event('drop', eo));
208
- pasteZone.trigger($.Event('paste', eo));
209
- fu.fileupload('enable');
210
- fileInput.trigger($.Event('change', eo));
211
- dropZone.trigger($.Event('dragover', eo));
212
- dropZone.trigger($.Event('drop', eo));
213
- pasteZone.trigger($.Event('paste', eo));
214
- });
215
-
216
- test('option', function () {
217
- expect(
218
- $.support.xhrFormDataFileUpload ? 10 : 7
219
- );
220
- var eo = {
221
- originalEvent: {
222
- dataTransfer: {files: [{}], types: ['Files']},
223
- clipboardData: {items: [{}]}
224
- }
225
- },
226
- fu = $('#fileupload').fileupload({
227
- pasteZone: document,
228
- dragover: function () {
229
- ok(true, 'Triggers dragover callback');
230
- return false;
231
- },
232
- drop: function () {
233
- ok(true, 'Triggers drop callback');
234
- return false;
235
- },
236
- paste: function () {
237
- ok(true, 'Triggers paste callback');
238
- return false;
239
- },
240
- change: function () {
241
- ok(true, 'Triggers change callback');
242
- return false;
243
- }
244
- }),
245
- fileInput = fu.fileupload('option', 'fileInput'),
246
- dropZone = fu.fileupload('option', 'dropZone'),
247
- pasteZone = fu.fileupload('option', 'pasteZone');
248
- fu.fileupload('option', 'fileInput', null);
249
- fu.fileupload('option', 'dropZone', null);
250
- fu.fileupload('option', 'pasteZone', null);
251
- fileInput.trigger($.Event('change', eo));
252
- dropZone.trigger($.Event('dragover', eo));
253
- dropZone.trigger($.Event('drop', eo));
254
- pasteZone.trigger($.Event('paste', eo));
255
- fu.fileupload('option', 'dropZone', 'body');
256
- strictEqual(
257
- fu.fileupload('option', 'dropZone')[0],
258
- document.body,
259
- 'Allow a query string as parameter for the dropZone option'
260
- );
261
- fu.fileupload('option', 'dropZone', document);
262
- strictEqual(
263
- fu.fileupload('option', 'dropZone')[0],
264
- document,
265
- 'Allow a document element as parameter for the dropZone option'
266
- );
267
- fu.fileupload('option', 'pasteZone', 'body');
268
- strictEqual(
269
- fu.fileupload('option', 'pasteZone')[0],
270
- document.body,
271
- 'Allow a query string as parameter for the pasteZone option'
272
- );
273
- fu.fileupload('option', 'pasteZone', document);
274
- strictEqual(
275
- fu.fileupload('option', 'pasteZone')[0],
276
- document,
277
- 'Allow a document element as parameter for the pasteZone option'
278
- );
279
- fu.fileupload('option', 'fileInput', ':file');
280
- strictEqual(
281
- fu.fileupload('option', 'fileInput')[0],
282
- $(':file')[0],
283
- 'Allow a query string as parameter for the fileInput option'
284
- );
285
- fu.fileupload('option', 'fileInput', $(':file')[0]);
286
- strictEqual(
287
- fu.fileupload('option', 'fileInput')[0],
288
- $(':file')[0],
289
- 'Allow a document element as parameter for the fileInput option'
290
- );
291
- fu.fileupload('option', 'fileInput', fileInput);
292
- fu.fileupload('option', 'dropZone', dropZone);
293
- fu.fileupload('option', 'pasteZone', pasteZone);
294
- fileInput.trigger($.Event('change', eo));
295
- dropZone.trigger($.Event('dragover', eo));
296
- dropZone.trigger($.Event('drop', eo));
297
- pasteZone.trigger($.Event('paste', eo));
298
- });
299
-
300
- asyncTest('add', function () {
301
- expect(2);
302
- var param = {files: [{name: 'test'}]};
303
- $('#fileupload').fileupload({
304
- add: function (e, data) {
305
- strictEqual(
306
- data.files[0].name,
307
- param.files[0].name,
308
- 'Triggers add callback'
309
- );
310
- }
311
- }).fileupload('add', param).fileupload(
312
- 'option',
313
- 'add',
314
- function (e, data) {
315
- data.submit().complete(function () {
316
- ok(true, 'data.submit() Returns a jqXHR object');
317
- start();
318
- });
319
- }
320
- ).fileupload('add', param);
321
- });
322
-
323
- asyncTest('send', function () {
324
- expect(3);
325
- var param = {files: [{name: 'test'}]};
326
- $('#fileupload').fileupload({
327
- send: function (e, data) {
328
- strictEqual(
329
- data.files[0].name,
330
- 'test',
331
- 'Triggers send callback'
332
- );
333
- }
334
- }).fileupload('send', param).fail(function () {
335
- ok(true, 'Allows to abort the request');
336
- }).complete(function () {
337
- ok(true, 'Returns a jqXHR object');
338
- start();
339
- }).abort();
340
- });
341
-
342
- module('Callbacks', lifecycle);
343
-
344
- asyncTest('add', function () {
345
- expect(1);
346
- var param = {files: [{name: 'test'}]};
347
- $('#fileupload').fileupload({
348
- add: function () {
349
- ok(true, 'Triggers add callback');
350
- start();
351
- }
352
- }).fileupload('add', param);
353
- });
354
-
355
- asyncTest('submit', function () {
356
- expect(1);
357
- var param = {files: [{name: 'test'}]};
358
- $('#fileupload').fileupload({
359
- submit: function () {
360
- ok(true, 'Triggers submit callback');
361
- start();
362
- return false;
363
- }
364
- }).fileupload('add', param);
365
- });
366
-
367
- asyncTest('send', function () {
368
- expect(1);
369
- var param = {files: [{name: 'test'}]};
370
- $('#fileupload').fileupload({
371
- send: function () {
372
- ok(true, 'Triggers send callback');
373
- start();
374
- return false;
375
- }
376
- }).fileupload('send', param);
377
- });
378
-
379
- asyncTest('done', function () {
380
- expect(1);
381
- var param = {files: [{name: 'test'}]};
382
- $('#fileupload').fileupload({
383
- done: function () {
384
- ok(true, 'Triggers done callback');
385
- start();
386
- }
387
- }).fileupload('send', param);
388
- });
389
-
390
- asyncTest('fail', function () {
391
- expect(1);
392
- var param = {files: [{name: 'test'}]},
393
- fu = $('#fileupload').fileupload({
394
- url: '404',
395
- fail: function () {
396
- ok(true, 'Triggers fail callback');
397
- start();
398
- }
399
- });
400
- (fu.data('blueimp-fileupload') || fu.data('fileupload'))
401
- ._isXHRUpload = function () {
402
- return true;
403
- };
404
- fu.fileupload('send', param);
405
- });
406
-
407
- asyncTest('always', function () {
408
- expect(2);
409
- var param = {files: [{name: 'test'}]},
410
- counter = 0,
411
- fu = $('#fileupload').fileupload({
412
- always: function () {
413
- ok(true, 'Triggers always callback');
414
- if (counter === 1) {
415
- start();
416
- } else {
417
- counter += 1;
418
- }
419
- }
420
- });
421
- (fu.data('blueimp-fileupload') || fu.data('fileupload'))
422
- ._isXHRUpload = function () {
423
- return true;
424
- };
425
- fu.fileupload('add', param).fileupload(
426
- 'option',
427
- 'url',
428
- '404'
429
- ).fileupload('add', param);
430
- });
431
-
432
- asyncTest('progress', function () {
433
- expect(1);
434
- var param = {files: [{name: 'test'}]},
435
- counter = 0;
436
- $('#fileupload').fileupload({
437
- forceIframeTransport: true,
438
- progress: function () {
439
- ok(true, 'Triggers progress callback');
440
- if (counter === 0) {
441
- start();
442
- } else {
443
- counter += 1;
444
- }
445
- }
446
- }).fileupload('send', param);
447
- });
448
-
449
- asyncTest('progressall', function () {
450
- expect(1);
451
- var param = {files: [{name: 'test'}]},
452
- counter = 0;
453
- $('#fileupload').fileupload({
454
- forceIframeTransport: true,
455
- progressall: function () {
456
- ok(true, 'Triggers progressall callback');
457
- if (counter === 0) {
458
- start();
459
- } else {
460
- counter += 1;
461
- }
462
- }
463
- }).fileupload('send', param);
464
- });
465
-
466
- asyncTest('start', function () {
467
- expect(1);
468
- var param = {files: [{name: '1'}, {name: '2'}]},
469
- active = 0;
470
- $('#fileupload').fileupload({
471
- send: function () {
472
- active += 1;
473
- },
474
- start: function () {
475
- ok(!active, 'Triggers start callback before uploads');
476
- start();
477
- }
478
- }).fileupload('send', param);
479
- });
480
-
481
- asyncTest('stop', function () {
482
- expect(1);
483
- var param = {files: [{name: '1'}, {name: '2'}]},
484
- active = 0;
485
- $('#fileupload').fileupload({
486
- send: function () {
487
- active += 1;
488
- },
489
- always: function () {
490
- active -= 1;
491
- },
492
- stop: function () {
493
- ok(!active, 'Triggers stop callback after uploads');
494
- start();
495
- }
496
- }).fileupload('send', param);
497
- });
498
-
499
- test('change', function () {
500
- var fu = $('#fileupload').fileupload(),
501
- fuo = fu.data('blueimp-fileupload') || fu.data('fileupload'),
502
- fileInput = fu.fileupload('option', 'fileInput');
503
- expect(2);
504
- fu.fileupload({
505
- change: function (e, data) {
506
- ok(true, 'Triggers change callback');
507
- strictEqual(
508
- data.files.length,
509
- 0,
510
- 'Returns empty files list'
511
- );
512
- },
513
- add: $.noop
514
- });
515
- fuo._onChange({
516
- data: {fileupload: fuo},
517
- target: fileInput[0]
518
- });
519
- });
520
-
521
- test('paste', function () {
522
- var fu = $('#fileupload').fileupload(),
523
- fuo = fu.data('blueimp-fileupload') || fu.data('fileupload');
524
- expect(1);
525
- fu.fileupload({
526
- paste: function () {
527
- ok(true, 'Triggers paste callback');
528
- },
529
- add: $.noop
530
- });
531
- fuo._onPaste({
532
- data: {fileupload: fuo},
533
- originalEvent: {
534
- dataTransfer: {files: [{}]},
535
- clipboardData: {items: [{}]}
536
- },
537
- preventDefault: $.noop
538
- });
539
- });
540
-
541
- test('drop', function () {
542
- var fu = $('#fileupload').fileupload(),
543
- fuo = fu.data('blueimp-fileupload') || fu.data('fileupload');
544
- expect(1);
545
- fu.fileupload({
546
- drop: function () {
547
- ok(true, 'Triggers drop callback');
548
- },
549
- add: $.noop
550
- });
551
- fuo._onDrop({
552
- data: {fileupload: fuo},
553
- originalEvent: {
554
- dataTransfer: {files: [{}]},
555
- clipboardData: {items: [{}]}
556
- },
557
- preventDefault: $.noop
558
- });
559
- });
560
-
561
- test('dragover', function () {
562
- var fu = $('#fileupload').fileupload(),
563
- fuo = fu.data('blueimp-fileupload') || fu.data('fileupload');
564
- expect(1);
565
- fu.fileupload({
566
- dragover: function () {
567
- ok(true, 'Triggers dragover callback');
568
- },
569
- add: $.noop
570
- });
571
- fuo._onDragOver({
572
- data: {fileupload: fuo},
573
- originalEvent: {dataTransfer: {types: ['Files']}},
574
- preventDefault: $.noop
575
- });
576
- });
577
-
578
- module('Options', lifecycle);
579
-
580
- test('paramName', function () {
581
- expect(1);
582
- var param = {files: [{name: 'test'}]};
583
- $('#fileupload').fileupload({
584
- paramName: null,
585
- send: function (e, data) {
586
- strictEqual(
587
- data.paramName[0],
588
- data.fileInput.prop('name'),
589
- 'Takes paramName from file input field if not set'
590
- );
591
- return false;
592
- }
593
- }).fileupload('send', param);
594
- });
595
-
596
- test('url', function () {
597
- expect(1);
598
- var param = {files: [{name: 'test'}]};
599
- $('#fileupload').fileupload({
600
- url: null,
601
- send: function (e, data) {
602
- strictEqual(
603
- data.url,
604
- $(data.fileInput.prop('form')).prop('action'),
605
- 'Takes url from form action if not set'
606
- );
607
- return false;
608
- }
609
- }).fileupload('send', param);
610
- });
611
-
612
- test('type', function () {
613
- expect(2);
614
- var param = {files: [{name: 'test'}]};
615
- $('#fileupload').fileupload({
616
- type: null,
617
- send: function (e, data) {
618
- strictEqual(
619
- data.type,
620
- 'POST',
621
- 'Request type is "POST" if not set to "PUT"'
622
- );
623
- return false;
624
- }
625
- }).fileupload('send', param);
626
- $('#fileupload').fileupload({
627
- type: 'PUT',
628
- send: function (e, data) {
629
- strictEqual(
630
- data.type,
631
- 'PUT',
632
- 'Request type is "PUT" if set to "PUT"'
633
- );
634
- return false;
635
- }
636
- }).fileupload('send', param);
637
- });
638
-
639
- test('replaceFileInput', function () {
640
- var fu = $('#fileupload').fileupload(),
641
- fuo = fu.data('blueimp-fileupload') || fu.data('fileupload'),
642
- fileInput = fu.fileupload('option', 'fileInput'),
643
- fileInputElement = fileInput[0];
644
- expect(2);
645
- fu.fileupload({
646
- replaceFileInput: false,
647
- change: function () {
648
- strictEqual(
649
- fu.fileupload('option', 'fileInput')[0],
650
- fileInputElement,
651
- 'Keeps file input with replaceFileInput: false'
652
- );
653
- },
654
- add: $.noop
655
- });
656
- fuo._onChange({
657
- data: {fileupload: fuo},
658
- target: fileInput[0]
659
- });
660
- fu.fileupload({
661
- replaceFileInput: true,
662
- change: function () {
663
- notStrictEqual(
664
- fu.fileupload('option', 'fileInput')[0],
665
- fileInputElement,
666
- 'Replaces file input with replaceFileInput: true'
667
- );
668
- },
669
- add: $.noop
670
- });
671
- fuo._onChange({
672
- data: {fileupload: fuo},
673
- target: fileInput[0]
674
- });
675
- });
676
-
677
- asyncTest('forceIframeTransport', function () {
678
- expect(1);
679
- var param = {files: [{name: 'test'}]};
680
- $('#fileupload').fileupload({
681
- forceIframeTransport: true,
682
- done: function (e, data) {
683
- strictEqual(
684
- data.dataType.substr(0, 6),
685
- 'iframe',
686
- 'Iframe Transport is used'
687
- );
688
- start();
689
- }
690
- }).fileupload('send', param);
691
- });
692
-
693
- test('singleFileUploads', function () {
694
- expect(3);
695
- var fu = $('#fileupload').fileupload(),
696
- param = {files: [{name: '1'}, {name: '2'}]},
697
- index = 1;
698
- (fu.data('blueimp-fileupload') || fu.data('fileupload'))
699
- ._isXHRUpload = function () {
700
- return true;
701
- };
702
- $('#fileupload').fileupload({
703
- singleFileUploads: true,
704
- add: function () {
705
- ok(true, 'Triggers callback number ' + index.toString());
706
- index += 1;
707
- }
708
- }).fileupload('add', param).fileupload(
709
- 'option',
710
- 'singleFileUploads',
711
- false
712
- ).fileupload('add', param);
713
- });
714
-
715
- test('limitMultiFileUploads', function () {
716
- expect(3);
717
- var fu = $('#fileupload').fileupload(),
718
- param = {files: [
719
- {name: '1'},
720
- {name: '2'},
721
- {name: '3'},
722
- {name: '4'},
723
- {name: '5'}
724
- ]},
725
- index = 1;
726
- (fu.data('blueimp-fileupload') || fu.data('fileupload'))
727
- ._isXHRUpload = function () {
728
- return true;
729
- };
730
- $('#fileupload').fileupload({
731
- singleFileUploads: false,
732
- limitMultiFileUploads: 2,
733
- add: function () {
734
- ok(true, 'Triggers callback number ' + index.toString());
735
- index += 1;
736
- }
737
- }).fileupload('add', param);
738
- });
739
-
740
- test('limitMultiFileUploadSize', function () {
741
- expect(7);
742
- var fu = $('#fileupload').fileupload(),
743
- param = {files: [
744
- {name: '1-1', size: 100000},
745
- {name: '1-2', size: 40000},
746
- {name: '2-1', size: 100000},
747
- {name: '3-1', size: 50000},
748
- {name: '3-2', size: 40000},
749
- {name: '4-1', size: 45000} // New request due to limitMultiFileUploads
750
- ]},
751
- param2 = {files: [
752
- {name: '5-1'},
753
- {name: '5-2'},
754
- {name: '6-1'},
755
- {name: '6-2'},
756
- {name: '7-1'}
757
- ]},
758
- index = 1;
759
- (fu.data('blueimp-fileupload') || fu.data('fileupload'))
760
- ._isXHRUpload = function () {
761
- return true;
762
- };
763
- $('#fileupload').fileupload({
764
- singleFileUploads: false,
765
- limitMultiFileUploads: 2,
766
- limitMultiFileUploadSize: 150000,
767
- limitMultiFileUploadSizeOverhead: 5000,
768
- add: function () {
769
- ok(true, 'Triggers callback number ' + index.toString());
770
- index += 1;
771
- }
772
- }).fileupload('add', param).fileupload('add', param2);
773
- });
774
-
775
- asyncTest('sequentialUploads', function () {
776
- expect(6);
777
- var param = {files: [
778
- {name: '1'},
779
- {name: '2'},
780
- {name: '3'},
781
- {name: '4'},
782
- {name: '5'},
783
- {name: '6'}
784
- ]},
785
- addIndex = 0,
786
- sendIndex = 0,
787
- loadIndex = 0,
788
- fu = $('#fileupload').fileupload({
789
- sequentialUploads: true,
790
- add: function (e, data) {
791
- addIndex += 1;
792
- if (addIndex === 4) {
793
- data.submit().abort();
794
- } else {
795
- data.submit();
796
- }
797
- },
798
- send: function () {
799
- sendIndex += 1;
800
- },
801
- done: function () {
802
- loadIndex += 1;
803
- strictEqual(sendIndex, loadIndex, 'upload in order');
804
- },
805
- fail: function (e, data) {
806
- strictEqual(data.errorThrown, 'abort', 'upload aborted');
807
- },
808
- stop: function () {
809
- start();
810
- }
811
- });
812
- (fu.data('blueimp-fileupload') || fu.data('fileupload'))
813
- ._isXHRUpload = function () {
814
- return true;
815
- };
816
- fu.fileupload('add', param);
817
- });
818
-
819
- asyncTest('limitConcurrentUploads', function () {
820
- expect(12);
821
- var param = {files: [
822
- {name: '1'},
823
- {name: '2'},
824
- {name: '3'},
825
- {name: '4'},
826
- {name: '5'},
827
- {name: '6'},
828
- {name: '7'},
829
- {name: '8'},
830
- {name: '9'},
831
- {name: '10'},
832
- {name: '11'},
833
- {name: '12'}
834
- ]},
835
- addIndex = 0,
836
- sendIndex = 0,
837
- loadIndex = 0,
838
- fu = $('#fileupload').fileupload({
839
- limitConcurrentUploads: 3,
840
- add: function (e, data) {
841
- addIndex += 1;
842
- if (addIndex === 4) {
843
- data.submit().abort();
844
- } else {
845
- data.submit();
846
- }
847
- },
848
- send: function () {
849
- sendIndex += 1;
850
- },
851
- done: function () {
852
- loadIndex += 1;
853
- ok(sendIndex - loadIndex < 3);
854
- },
855
- fail: function (e, data) {
856
- strictEqual(data.errorThrown, 'abort', 'upload aborted');
857
- },
858
- stop: function () {
859
- start();
860
- }
861
- });
862
- (fu.data('blueimp-fileupload') || fu.data('fileupload'))
863
- ._isXHRUpload = function () {
864
- return true;
865
- };
866
- fu.fileupload('add', param);
867
- });
868
-
869
- if ($.support.xhrFileUpload) {
870
- asyncTest('multipart', function () {
871
- expect(2);
872
- var param = {files: [{
873
- name: 'test.png',
874
- size: 123,
875
- type: 'image/png'
876
- }]},
877
- fu = $('#fileupload').fileupload({
878
- multipart: false,
879
- always: function (e, data) {
880
- strictEqual(
881
- data.contentType,
882
- param.files[0].type,
883
- 'non-multipart upload sets file type as contentType'
884
- );
885
- strictEqual(
886
- data.headers['Content-Disposition'],
887
- 'attachment; filename="' + param.files[0].name + '"',
888
- 'non-multipart upload sets Content-Disposition header'
889
- );
890
- start();
891
- }
892
- });
893
- fu.fileupload('send', param);
894
- });
895
- }
896
-
897
- module('UI Initialization', lifecycleUI);
898
-
899
- test('Widget initialization', function () {
900
- var fu = $('#fileupload').fileupload();
901
- ok(fu.data('blueimp-fileupload') || fu.data('fileupload'));
902
- ok(
903
- $('#fileupload').fileupload('option', 'uploadTemplate').length,
904
- 'Initialized upload template'
905
- );
906
- ok(
907
- $('#fileupload').fileupload('option', 'downloadTemplate').length,
908
- 'Initialized download template'
909
- );
910
- });
911
-
912
- test('Buttonbar event listeners', function () {
913
- var buttonbar = $('#fileupload .fileupload-buttonbar'),
914
- files = [{name: 'test'}];
915
- expect(4);
916
- $('#fileupload').fileupload({
917
- send: function () {
918
- ok(true, 'Started file upload via global start button');
919
- },
920
- fail: function (e, data) {
921
- ok(true, 'Canceled file upload via global cancel button');
922
- data.context.remove();
923
- },
924
- destroy: function () {
925
- ok(true, 'Delete action called via global delete button');
926
- }
927
- });
928
- $('#fileupload').fileupload('add', {files: files});
929
- buttonbar.find('.cancel').click();
930
- $('#fileupload').fileupload('add', {files: files});
931
- buttonbar.find('.start').click();
932
- buttonbar.find('.cancel').click();
933
- files[0].deleteUrl = 'http://example.org/banana.jpg';
934
- ($('#fileupload').data('blueimp-fileupload') ||
935
- $('#fileupload').data('fileupload'))
936
- ._renderDownload(files)
937
- .appendTo($('#fileupload .files')).show()
938
- .find('.toggle').click();
939
- buttonbar.find('.delete').click();
940
- });
941
-
942
- module('UI API', lifecycleUI);
943
-
944
- test('destroy', function () {
945
- var buttonbar = $('#fileupload .fileupload-buttonbar'),
946
- files = [{name: 'test'}];
947
- expect(1);
948
- $('#fileupload').fileupload({
949
- send: function () {
950
- ok(true, 'This test should not run');
951
- return false;
952
- }
953
- })
954
- .fileupload('add', {files: files})
955
- .fileupload('destroy');
956
- buttonbar.find('.start').click(function () {
957
- ok(true, 'Clicked global start button');
958
- return false;
959
- }).click();
960
- });
961
-
962
- test('disable/enable', function () {
963
- var buttonbar = $('#fileupload .fileupload-buttonbar');
964
- $('#fileupload').fileupload();
965
- $('#fileupload').fileupload('disable');
966
- strictEqual(
967
- buttonbar.find('input[type=file], button').not(':disabled').length,
968
- 0,
969
- 'Disables the buttonbar buttons'
970
- );
971
- $('#fileupload').fileupload('enable');
972
- strictEqual(
973
- buttonbar.find('input[type=file], button').not(':disabled').length,
974
- 4,
975
- 'Enables the buttonbar buttons'
976
- );
977
- });
978
-
979
- module('UI Callbacks', lifecycleUI);
980
-
981
- test('destroy', function () {
982
- expect(3);
983
- $('#fileupload').fileupload({
984
- destroy: function (e, data) {
985
- ok(true, 'Triggers destroy callback');
986
- strictEqual(
987
- data.url,
988
- 'test',
989
- 'Passes over deletion url parameter'
990
- );
991
- strictEqual(
992
- data.type,
993
- 'DELETE',
994
- 'Passes over deletion request type parameter'
995
- );
996
- }
997
- });
998
- ($('#fileupload').data('blueimp-fileupload') ||
999
- $('#fileupload').data('fileupload'))
1000
- ._renderDownload([{
1001
- name: 'test',
1002
- deleteUrl: 'test',
1003
- deleteType: 'DELETE'
1004
- }])
1005
- .appendTo($('#fileupload .files'))
1006
- .show()
1007
- .find('.toggle').click();
1008
- $('#fileupload .fileupload-buttonbar .delete').click();
1009
- });
1010
-
1011
- asyncTest('added', function () {
1012
- expect(1);
1013
- var param = {files: [{name: 'test'}]};
1014
- $('#fileupload').fileupload({
1015
- added: function (e, data) {
1016
- start();
1017
- strictEqual(
1018
- data.files[0].name,
1019
- param.files[0].name,
1020
- 'Triggers added callback'
1021
- );
1022
- },
1023
- send: function () {
1024
- return false;
1025
- }
1026
- }).fileupload('add', param);
1027
- });
1028
-
1029
- asyncTest('started', function () {
1030
- expect(1);
1031
- var param = {files: [{name: 'test'}]};
1032
- $('#fileupload').fileupload({
1033
- started: function () {
1034
- start();
1035
- ok('Triggers started callback');
1036
- return false;
1037
- },
1038
- sent: function () {
1039
- return false;
1040
- }
1041
- }).fileupload('send', param);
1042
- });
1043
-
1044
- asyncTest('sent', function () {
1045
- expect(1);
1046
- var param = {files: [{name: 'test'}]};
1047
- $('#fileupload').fileupload({
1048
- sent: function (e, data) {
1049
- start();
1050
- strictEqual(
1051
- data.files[0].name,
1052
- param.files[0].name,
1053
- 'Triggers sent callback'
1054
- );
1055
- return false;
1056
- }
1057
- }).fileupload('send', param);
1058
- });
1059
-
1060
- asyncTest('completed', function () {
1061
- expect(1);
1062
- var param = {files: [{name: 'test'}]};
1063
- $('#fileupload').fileupload({
1064
- completed: function () {
1065
- start();
1066
- ok('Triggers completed callback');
1067
- return false;
1068
- }
1069
- }).fileupload('send', param);
1070
- });
1071
-
1072
- asyncTest('failed', function () {
1073
- expect(1);
1074
- var param = {files: [{name: 'test'}]};
1075
- $('#fileupload').fileupload({
1076
- failed: function () {
1077
- start();
1078
- ok('Triggers failed callback');
1079
- return false;
1080
- }
1081
- }).fileupload('send', param).abort();
1082
- });
1083
-
1084
- asyncTest('stopped', function () {
1085
- expect(1);
1086
- var param = {files: [{name: 'test'}]};
1087
- $('#fileupload').fileupload({
1088
- stopped: function () {
1089
- start();
1090
- ok('Triggers stopped callback');
1091
- return false;
1092
- }
1093
- }).fileupload('send', param);
1094
- });
1095
-
1096
- asyncTest('destroyed', function () {
1097
- expect(1);
1098
- $('#fileupload').fileupload({
1099
- dataType: 'html',
1100
- destroyed: function () {
1101
- start();
1102
- ok(true, 'Triggers destroyed callback');
1103
- }
1104
- });
1105
- ($('#fileupload').data('blueimp-fileupload') ||
1106
- $('#fileupload').data('fileupload'))
1107
- ._renderDownload([{
1108
- name: 'test',
1109
- deleteUrl: '.',
1110
- deleteType: 'GET'
1111
- }])
1112
- .appendTo($('#fileupload .files'))
1113
- .show()
1114
- .find('.toggle').click();
1115
- $('#fileupload .fileupload-buttonbar .delete').click();
1116
- });
1117
-
1118
- module('UI Options', lifecycleUI);
1119
-
1120
- test('autoUpload', function () {
1121
- expect(1);
1122
- $('#fileupload')
1123
- .fileupload({
1124
- autoUpload: true,
1125
- send: function () {
1126
- ok(true, 'Started file upload automatically');
1127
- return false;
1128
- }
1129
- })
1130
- .fileupload('add', {files: [{name: 'test'}]})
1131
- .fileupload('option', 'autoUpload', false)
1132
- .fileupload('add', {files: [{name: 'test'}]});
1133
- });
1134
-
1135
- test('maxNumberOfFiles', function () {
1136
- expect(3);
1137
- var addIndex = 0,
1138
- sendIndex = 0;
1139
- $('#fileupload')
1140
- .fileupload({
1141
- autoUpload: true,
1142
- maxNumberOfFiles: 3,
1143
- singleFileUploads: false,
1144
- send: function () {
1145
- strictEqual(
1146
- sendIndex += 1,
1147
- addIndex
1148
- );
1149
- },
1150
- progress: $.noop,
1151
- progressall: $.noop,
1152
- done: $.noop,
1153
- stop: $.noop
1154
- })
1155
- .fileupload('add', {files: [{name: (addIndex += 1)}]})
1156
- .fileupload('add', {files: [{name: (addIndex += 1)}]})
1157
- .fileupload('add', {files: [{name: (addIndex += 1)}]})
1158
- .fileupload('add', {files: [{name: 'test'}]});
1159
- });
1160
-
1161
- test('maxFileSize', function () {
1162
- expect(2);
1163
- var addIndex = 0,
1164
- sendIndex = 0;
1165
- $('#fileupload')
1166
- .fileupload({
1167
- autoUpload: true,
1168
- maxFileSize: 1000,
1169
- send: function () {
1170
- strictEqual(
1171
- sendIndex += 1,
1172
- addIndex
1173
- );
1174
- return false;
1175
- }
1176
- })
1177
- .fileupload('add', {files: [{
1178
- name: (addIndex += 1)
1179
- }]})
1180
- .fileupload('add', {files: [{
1181
- name: (addIndex += 1),
1182
- size: 999
1183
- }]})
1184
- .fileupload('add', {files: [{
1185
- name: 'test',
1186
- size: 1001
1187
- }]})
1188
- .fileupload({
1189
- send: function (e, data) {
1190
- ok(
1191
- !$.blueimp.fileupload.prototype.options
1192
- .send.call(this, e, data)
1193
- );
1194
- return false;
1195
- }
1196
- });
1197
- });
1198
-
1199
- test('minFileSize', function () {
1200
- expect(2);
1201
- var addIndex = 0,
1202
- sendIndex = 0;
1203
- $('#fileupload')
1204
- .fileupload({
1205
- autoUpload: true,
1206
- minFileSize: 1000,
1207
- send: function () {
1208
- strictEqual(
1209
- sendIndex += 1,
1210
- addIndex
1211
- );
1212
- return false;
1213
- }
1214
- })
1215
- .fileupload('add', {files: [{
1216
- name: (addIndex += 1)
1217
- }]})
1218
- .fileupload('add', {files: [{
1219
- name: (addIndex += 1),
1220
- size: 1001
1221
- }]})
1222
- .fileupload('add', {files: [{
1223
- name: 'test',
1224
- size: 999
1225
- }]})
1226
- .fileupload({
1227
- send: function (e, data) {
1228
- ok(
1229
- !$.blueimp.fileupload.prototype.options
1230
- .send.call(this, e, data)
1231
- );
1232
- return false;
1233
- }
1234
- });
1235
- });
1236
-
1237
- test('acceptFileTypes', function () {
1238
- expect(2);
1239
- var addIndex = 0,
1240
- sendIndex = 0;
1241
- $('#fileupload')
1242
- .fileupload({
1243
- autoUpload: true,
1244
- acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
1245
- disableImageMetaDataLoad: true,
1246
- send: function () {
1247
- strictEqual(
1248
- sendIndex += 1,
1249
- addIndex
1250
- );
1251
- return false;
1252
- }
1253
- })
1254
- .fileupload('add', {files: [{
1255
- name: (addIndex += 1) + '.jpg'
1256
- }]})
1257
- .fileupload('add', {files: [{
1258
- name: (addIndex += 1),
1259
- type: 'image/jpeg'
1260
- }]})
1261
- .fileupload('add', {files: [{
1262
- name: 'test.txt',
1263
- type: 'text/plain'
1264
- }]})
1265
- .fileupload({
1266
- send: function (e, data) {
1267
- ok(
1268
- !$.blueimp.fileupload.prototype.options
1269
- .send.call(this, e, data)
1270
- );
1271
- return false;
1272
- }
1273
- });
1274
- });
1275
-
1276
- test('acceptFileTypes as HTML5 data attribute', function () {
1277
- expect(2);
1278
- var regExp = /(\.|\/)(gif|jpe?g|png)$/i;
1279
- $('#fileupload')
1280
- .attr('data-accept-file-types', regExp.toString())
1281
- .fileupload();
1282
- strictEqual(
1283
- $.type($('#fileupload').fileupload('option', 'acceptFileTypes')),
1284
- $.type(regExp)
1285
- );
1286
- strictEqual(
1287
- $('#fileupload').fileupload('option', 'acceptFileTypes').toString(),
1288
- regExp.toString()
1289
- );
1290
- });
1291
-
1292
- });