card-mod-script 0.14.2 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/real.yml +50 -0
- data/lib/ansi2html.rb +69 -0
- data/lib/card/mod/script.rb +1 -0
- data/set/abstract/00_script.rb +4 -4
- data/set/abstract/02_coffee_script.rb +9 -1
- data/set/all/head_javascript.rb +13 -22
- data/set/right/script.rb +1 -1
- data/set/type/coffee_script.rb +6 -0
- data/set/type/java_script.rb +6 -0
- data/set/type/local_script_folder_group.rb +2 -0
- data/set/type/local_script_manifest_group.rb +2 -0
- data/set/type_plus_right/mod/script.rb +1 -5
- data/set/type_plus_right/set/script.rb +3 -1
- metadata +13 -119
- data/assets/script/decko/autosave.js.coffee +0 -30
- data/assets/script/decko/bridge.js.coffee +0 -31
- data/assets/script/decko/card_menu.js.coffee +0 -26
- data/assets/script/decko/components.js.coffee +0 -49
- data/assets/script/decko/decko.js.coffee +0 -82
- data/assets/script/decko/doubleclick.js.coffee +0 -30
- data/assets/script/decko/editor.js.coffee +0 -57
- data/assets/script/decko/filter.js.coffee +0 -183
- data/assets/script/decko/filter_items.js.coffee +0 -128
- data/assets/script/decko/filter_links.js.coffee +0 -81
- data/assets/script/decko/follow.js.coffee +0 -22
- data/assets/script/decko/layout.js.coffee +0 -76
- data/assets/script/decko/link_editor.js.coffee +0 -61
- data/assets/script/decko/mod.js.coffee +0 -79
- data/assets/script/decko/modal.js.coffee +0 -113
- data/assets/script/decko/name_editor.js.coffee +0 -40
- data/assets/script/decko/navbox.js.coffee +0 -74
- data/assets/script/decko/nest_editor.js.coffee +0 -166
- data/assets/script/decko/nest_editor_name.js.coffee +0 -102
- data/assets/script/decko/nest_editor_options.js.coffee +0 -93
- data/assets/script/decko/nest_editor_rules.js.coffee +0 -3
- data/assets/script/decko/overlay.js.coffee +0 -54
- data/assets/script/decko/pointer_config.js.coffee +0 -79
- data/assets/script/decko/pointer_list_editor.js.coffee +0 -67
- data/assets/script/decko/recaptcha.js.coffee +0 -19
- data/assets/script/decko/selectable_filtered_content.js.coffee +0 -12
- data/assets/script/decko/slot.js.coffee +0 -182
- data/assets/script/decko/slot_ready.js.coffee +0 -12
- data/assets/script/decko/slotter.js.coffee +0 -268
- data/assets/script/decko/type_editor.js.coffee +0 -21
- data/assets/script/decko/upload.js.coffee +0 -64
- data/assets/script/jquery-ui.min.js +0 -13
- data/assets/script/jquery.autosize.js +0 -274
- data/assets/script/manifest.yml +0 -57
- data/db/migrate_core_cards/20200804112348_add_mod_script_assets_type.rb +0 -30
- data/vendor/jquery_file_upload/LICENSE.txt +0 -20
- data/vendor/jquery_file_upload/README.md +0 -224
- data/vendor/jquery_file_upload/SECURITY.md +0 -227
- data/vendor/jquery_file_upload/VULNERABILITIES.md +0 -118
- data/vendor/jquery_file_upload/cors/postmessage.html +0 -85
- data/vendor/jquery_file_upload/cors/result.html +0 -26
- data/vendor/jquery_file_upload/css/jquery.fileupload-noscript.css +0 -22
- data/vendor/jquery_file_upload/css/jquery.fileupload-ui-noscript.css +0 -17
- data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +0 -68
- data/vendor/jquery_file_upload/css/jquery.fileupload.css +0 -36
- data/vendor/jquery_file_upload/docker-compose.yml +0 -55
- data/vendor/jquery_file_upload/img/loading.gif +0 -0
- data/vendor/jquery_file_upload/img/progressbar.gif +0 -0
- data/vendor/jquery_file_upload/index.html +0 -357
- data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +0 -126
- data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +0 -97
- data/vendor/jquery_file_upload/js/demo.js +0 -75
- data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +0 -101
- data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +0 -347
- data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +0 -170
- data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +0 -759
- data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +0 -119
- data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +0 -101
- data/vendor/jquery_file_upload/js/jquery.fileupload.js +0 -1604
- data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +0 -227
- data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +0 -805
- data/vendor/jquery_file_upload/package-lock.json +0 -6853
- data/vendor/jquery_file_upload/package.json +0 -116
- data/vendor/jquery_file_upload/server/gae-python/app.yaml +0 -18
- data/vendor/jquery_file_upload/server/gae-python/main.py +0 -204
- data/vendor/jquery_file_upload/server/gae-python/static/favicon.ico +0 -0
- data/vendor/jquery_file_upload/server/gae-python/static/robots.txt +0 -2
- data/vendor/jquery_file_upload/server/php/Dockerfile +0 -44
- data/vendor/jquery_file_upload/server/php/UploadHandler.php +0 -1480
- data/vendor/jquery_file_upload/server/php/index.php +0 -15
- data/vendor/jquery_file_upload/server/php/php.ini +0 -5
- data/vendor/jquery_file_upload/test/index.html +0 -49
- data/vendor/jquery_file_upload/test/unit.js +0 -989
- data/vendor/jquery_file_upload/test/vendor/chai.js +0 -10854
- data/vendor/jquery_file_upload/test/vendor/mocha.css +0 -325
- data/vendor/jquery_file_upload/test/vendor/mocha.js +0 -18178
- data/vendor/jquery_file_upload/wdio/LICENSE.txt +0 -20
- data/vendor/jquery_file_upload/wdio/assets/black+white-3x2.jpg +0 -0
- data/vendor/jquery_file_upload/wdio/assets/black+white-60x40.gif +0 -0
- data/vendor/jquery_file_upload/wdio/conf/chrome.js +0 -40
- data/vendor/jquery_file_upload/wdio/conf/firefox.js +0 -25
- data/vendor/jquery_file_upload/wdio/hooks/index.js +0 -36
- data/vendor/jquery_file_upload/wdio/test/pages/file-upload.js +0 -79
- data/vendor/jquery_file_upload/wdio/test/specs/01-file-upload.js +0 -25
- data/vendor/jquery_file_upload/wdio/wdio.conf.js +0 -4
- data/vendor/jquery_rails/CHANGELOG.md +0 -359
- data/vendor/jquery_rails/CONTRIBUTING.md +0 -132
- data/vendor/jquery_rails/Gemfile +0 -22
- data/vendor/jquery_rails/MIT-LICENSE +0 -21
- data/vendor/jquery_rails/README.md +0 -75
- data/vendor/jquery_rails/Rakefile +0 -59
- data/vendor/jquery_rails/VERSIONS.md +0 -62
- data/vendor/jquery_rails/jquery-rails.gemspec +0 -26
- data/vendor/jquery_rails/lib/jquery/assert_select.rb +0 -149
- data/vendor/jquery_rails/lib/jquery/rails/engine.rb +0 -6
- data/vendor/jquery_rails/lib/jquery/rails/version.rb +0 -9
- data/vendor/jquery_rails/lib/jquery/rails.rb +0 -8
- data/vendor/jquery_rails/lib/jquery-rails.rb +0 -1
- data/vendor/jquery_rails/test/assert_select_jquery_test.rb +0 -85
- data/vendor/jquery_rails/test/test_helper.rb +0 -6
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery.js +0 -11008
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.js +0 -5
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.map +0 -1
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.js +0 -9814
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.js +0 -4
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.map +0 -1
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.js +0 -10364
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.js +0 -2
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.map +0 -1
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery_ujs.js +0 -555
@@ -1,989 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* jQuery File Upload Test
|
3
|
-
* https://github.com/blueimp/JavaScript-Load-Image
|
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 beforeEach, afterEach, describe, it */
|
13
|
-
/* eslint-disable new-cap */
|
14
|
-
|
15
|
-
(function (expect, $) {
|
16
|
-
'use strict';
|
17
|
-
|
18
|
-
var canCreateBlob = !!window.dataURLtoBlob;
|
19
|
-
// 80x60px GIF image (color black, base64 data):
|
20
|
-
var b64DataGIF =
|
21
|
-
'R0lGODdhUAA8AIABAAAAAP///ywAAAAAUAA8AAACS4SPqcvtD6' +
|
22
|
-
'OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73/g8MCofE' +
|
23
|
-
'ovGITCqXzKbzCY1Kp9Sq9YrNarfcrvcLDovH5PKsAAA7';
|
24
|
-
var imageUrlGIF = 'data:image/gif;base64,' + b64DataGIF;
|
25
|
-
var blobGIF = canCreateBlob && window.dataURLtoBlob(imageUrlGIF);
|
26
|
-
|
27
|
-
// 2x1px JPEG (color white, with the Exif orientation flag set to 6 and the
|
28
|
-
// IPTC ObjectName (2:5) set to 'objectname'):
|
29
|
-
var b64DataJPEG =
|
30
|
-
'/9j/4AAQSkZJRgABAQEAYABgAAD/4QAiRXhpZgAASUkqAAgAAAABABIBAwABAAAA' +
|
31
|
-
'BgASAAAAAAD/7QAsUGhvdG9zaG9wIDMuMAA4QklNBAQAAAAAAA8cAgUACm9iamVj' +
|
32
|
-
'dG5hbWUA/9sAQwABAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB' +
|
33
|
-
'AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB/9sAQwEBAQEBAQEBAQEBAQEBAQEB' +
|
34
|
-
'AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEB' +
|
35
|
-
'/8AAEQgAAQACAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYH' +
|
36
|
-
'CAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGh' +
|
37
|
-
'CCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldY' +
|
38
|
-
'WVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1' +
|
39
|
-
'tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8B' +
|
40
|
-
'AAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAEC' +
|
41
|
-
'dwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBka' +
|
42
|
-
'JicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWG' +
|
43
|
-
'h4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ' +
|
44
|
-
'2uLj5OXm5+jp6vLz9PX29/j5+v/aAAwDAQACEQMRAD8A/v4ooooA/9k=';
|
45
|
-
var imageUrlJPEG = 'data:image/jpeg;base64,' + b64DataJPEG;
|
46
|
-
var blobJPEG = canCreateBlob && window.dataURLtoBlob(imageUrlJPEG);
|
47
|
-
|
48
|
-
var fileGIF, fileJPEG, files, items, eventObject;
|
49
|
-
|
50
|
-
var uploadURL = '../server/php/';
|
51
|
-
|
52
|
-
/**
|
53
|
-
* Creates a fileupload form and adds it to the DOM
|
54
|
-
*
|
55
|
-
* @returns {object} jQuery node
|
56
|
-
*/
|
57
|
-
function createFileuploadForm() {
|
58
|
-
return $('<form><input type="file" name="files[]" multiple></form>')
|
59
|
-
.prop({
|
60
|
-
action: uploadURL,
|
61
|
-
method: 'POST',
|
62
|
-
enctype: 'multipart/form-data'
|
63
|
-
})
|
64
|
-
.css({ display: 'none' })
|
65
|
-
.appendTo(document.body);
|
66
|
-
}
|
67
|
-
|
68
|
-
/**
|
69
|
-
* Deletes all files from the upload server
|
70
|
-
*
|
71
|
-
* @param {Array} files Response files list
|
72
|
-
* @param {Function} callback Callback function
|
73
|
-
*/
|
74
|
-
function deleteFiles(files, callback) {
|
75
|
-
$.when(
|
76
|
-
files.map(function (file) {
|
77
|
-
return $.ajax({
|
78
|
-
type: file.deleteType,
|
79
|
-
url: file.deleteUrl
|
80
|
-
});
|
81
|
-
})
|
82
|
-
).always(function () {
|
83
|
-
callback();
|
84
|
-
});
|
85
|
-
}
|
86
|
-
|
87
|
-
beforeEach(function () {
|
88
|
-
fileGIF = new File([blobGIF], 'example.gif', { type: 'image/gif' });
|
89
|
-
fileJPEG = new File([blobJPEG], 'example.jpg', { type: 'image/jpeg' });
|
90
|
-
files = [fileGIF, fileJPEG];
|
91
|
-
items = [
|
92
|
-
{
|
93
|
-
getAsFile: function () {
|
94
|
-
return files[0];
|
95
|
-
}
|
96
|
-
},
|
97
|
-
{
|
98
|
-
getAsFile: function () {
|
99
|
-
return files[1];
|
100
|
-
}
|
101
|
-
}
|
102
|
-
];
|
103
|
-
eventObject = {
|
104
|
-
originalEvent: {
|
105
|
-
dataTransfer: { files: files, types: ['Files'] },
|
106
|
-
clipboardData: { items: items }
|
107
|
-
}
|
108
|
-
};
|
109
|
-
});
|
110
|
-
|
111
|
-
afterEach(function (done) {
|
112
|
-
$.getJSON(uploadURL).then(function (result) {
|
113
|
-
deleteFiles(result.files, done);
|
114
|
-
});
|
115
|
-
});
|
116
|
-
|
117
|
-
describe('Initialization', function () {
|
118
|
-
var form;
|
119
|
-
|
120
|
-
beforeEach(function () {
|
121
|
-
form = createFileuploadForm();
|
122
|
-
});
|
123
|
-
|
124
|
-
afterEach(function () {
|
125
|
-
form.remove();
|
126
|
-
});
|
127
|
-
|
128
|
-
it('widget', function () {
|
129
|
-
form.fileupload();
|
130
|
-
expect(form.data('blueimp-fileupload')).to.be.an('object');
|
131
|
-
});
|
132
|
-
|
133
|
-
it('file input', function () {
|
134
|
-
form.fileupload();
|
135
|
-
expect(form.fileupload('option', 'fileInput').length).to.equal(1);
|
136
|
-
});
|
137
|
-
|
138
|
-
it('drop zone', function () {
|
139
|
-
form.fileupload();
|
140
|
-
expect(form.fileupload('option', 'dropZone').length).to.equal(1);
|
141
|
-
});
|
142
|
-
|
143
|
-
it('paste zone', function () {
|
144
|
-
form.fileupload({ pasteZone: document });
|
145
|
-
expect(form.fileupload('option', 'pasteZone').length).to.equal(1);
|
146
|
-
});
|
147
|
-
|
148
|
-
it('data attributes', function () {
|
149
|
-
form.attr('data-url', 'https://example.org');
|
150
|
-
form.fileupload();
|
151
|
-
expect(form.fileupload('option', 'url')).to.equal('https://example.org');
|
152
|
-
expect(form.data('blueimp-fileupload')).to.be.an('object');
|
153
|
-
});
|
154
|
-
|
155
|
-
it('event listeners', function () {
|
156
|
-
var eventsData = {};
|
157
|
-
form.fileupload({
|
158
|
-
autoUpload: false,
|
159
|
-
pasteZone: document,
|
160
|
-
dragover: function () {
|
161
|
-
eventsData.dragover = true;
|
162
|
-
},
|
163
|
-
dragenter: function () {
|
164
|
-
eventsData.dragenter = true;
|
165
|
-
},
|
166
|
-
dragleave: function () {
|
167
|
-
eventsData.dragleave = true;
|
168
|
-
},
|
169
|
-
drop: function (e, data) {
|
170
|
-
eventsData.drop = data;
|
171
|
-
},
|
172
|
-
paste: function (e, data) {
|
173
|
-
eventsData.paste = data;
|
174
|
-
},
|
175
|
-
change: function () {
|
176
|
-
eventsData.change = true;
|
177
|
-
}
|
178
|
-
});
|
179
|
-
form
|
180
|
-
.fileupload('option', 'fileInput')
|
181
|
-
.trigger($.Event('change', eventObject));
|
182
|
-
expect(eventsData.change).to.equal(true);
|
183
|
-
form
|
184
|
-
.fileupload('option', 'dropZone')
|
185
|
-
.trigger($.Event('dragover', eventObject))
|
186
|
-
.trigger($.Event('dragenter', eventObject))
|
187
|
-
.trigger($.Event('dragleave', eventObject))
|
188
|
-
.trigger($.Event('drop', eventObject));
|
189
|
-
expect(eventsData.dragover).to.equal(true);
|
190
|
-
expect(eventsData.dragenter).to.equal(true);
|
191
|
-
expect(eventsData.dragleave).to.equal(true);
|
192
|
-
expect(eventsData.drop.files).to.deep.equal(files);
|
193
|
-
form
|
194
|
-
.fileupload('option', 'pasteZone')
|
195
|
-
.trigger($.Event('paste', eventObject));
|
196
|
-
expect(eventsData.paste.files).to.deep.equal(files);
|
197
|
-
});
|
198
|
-
});
|
199
|
-
|
200
|
-
describe('API', function () {
|
201
|
-
var form;
|
202
|
-
|
203
|
-
beforeEach(function () {
|
204
|
-
form = createFileuploadForm().fileupload({
|
205
|
-
dataType: 'json',
|
206
|
-
autoUpload: false
|
207
|
-
});
|
208
|
-
});
|
209
|
-
|
210
|
-
afterEach(function () {
|
211
|
-
form.remove();
|
212
|
-
});
|
213
|
-
|
214
|
-
it('destroy', function () {
|
215
|
-
var eventsData = {};
|
216
|
-
form.fileupload('option', {
|
217
|
-
pasteZone: document,
|
218
|
-
dragover: function () {
|
219
|
-
eventsData.dragover = true;
|
220
|
-
},
|
221
|
-
dragenter: function () {
|
222
|
-
eventsData.dragenter = true;
|
223
|
-
},
|
224
|
-
dragleave: function () {
|
225
|
-
eventsData.dragleave = true;
|
226
|
-
},
|
227
|
-
drop: function (e, data) {
|
228
|
-
eventsData.drop = data;
|
229
|
-
},
|
230
|
-
paste: function (e, data) {
|
231
|
-
eventsData.paste = data;
|
232
|
-
},
|
233
|
-
change: function () {
|
234
|
-
eventsData.change = true;
|
235
|
-
}
|
236
|
-
});
|
237
|
-
var fileInput = form.fileupload('option', 'fileInput');
|
238
|
-
var dropZone = form.fileupload('option', 'dropZone');
|
239
|
-
var pasteZone = form.fileupload('option', 'pasteZone');
|
240
|
-
form.fileupload('destroy');
|
241
|
-
expect(form.data('blueimp-fileupload')).to.equal();
|
242
|
-
fileInput.trigger($.Event('change', eventObject));
|
243
|
-
expect(eventsData.change).to.equal();
|
244
|
-
dropZone
|
245
|
-
.trigger($.Event('dragover', eventObject))
|
246
|
-
.trigger($.Event('dragenter', eventObject))
|
247
|
-
.trigger($.Event('dragleave', eventObject))
|
248
|
-
.trigger($.Event('drop', eventObject));
|
249
|
-
expect(eventsData.dragover).to.equal();
|
250
|
-
expect(eventsData.dragenter).to.equal();
|
251
|
-
expect(eventsData.dragleave).to.equal();
|
252
|
-
expect(eventsData.drop).to.equal();
|
253
|
-
pasteZone.trigger($.Event('paste', eventObject));
|
254
|
-
expect(eventsData.paste).to.equal();
|
255
|
-
});
|
256
|
-
|
257
|
-
it('disable', function () {
|
258
|
-
var eventsData = {};
|
259
|
-
form.fileupload('option', {
|
260
|
-
pasteZone: document,
|
261
|
-
dragover: function () {
|
262
|
-
eventsData.dragover = true;
|
263
|
-
},
|
264
|
-
dragenter: function () {
|
265
|
-
eventsData.dragenter = true;
|
266
|
-
},
|
267
|
-
dragleave: function () {
|
268
|
-
eventsData.dragleave = true;
|
269
|
-
},
|
270
|
-
drop: function (e, data) {
|
271
|
-
eventsData.drop = data;
|
272
|
-
},
|
273
|
-
paste: function (e, data) {
|
274
|
-
eventsData.paste = data;
|
275
|
-
},
|
276
|
-
change: function () {
|
277
|
-
eventsData.change = true;
|
278
|
-
}
|
279
|
-
});
|
280
|
-
form.fileupload('disable');
|
281
|
-
form
|
282
|
-
.fileupload('option', 'fileInput')
|
283
|
-
.trigger($.Event('change', eventObject));
|
284
|
-
expect(eventsData.change).to.equal();
|
285
|
-
form
|
286
|
-
.fileupload('option', 'dropZone')
|
287
|
-
.trigger($.Event('dragover', eventObject))
|
288
|
-
.trigger($.Event('dragenter', eventObject))
|
289
|
-
.trigger($.Event('dragleave', eventObject))
|
290
|
-
.trigger($.Event('drop', eventObject));
|
291
|
-
expect(eventsData.dragover).to.equal();
|
292
|
-
expect(eventsData.dragenter).to.equal();
|
293
|
-
expect(eventsData.dragleave).to.equal();
|
294
|
-
expect(eventsData.drop).to.equal();
|
295
|
-
form
|
296
|
-
.fileupload('option', 'pasteZone')
|
297
|
-
.trigger($.Event('paste', eventObject));
|
298
|
-
expect(eventsData.paste).to.equal();
|
299
|
-
});
|
300
|
-
|
301
|
-
it('enable', function () {
|
302
|
-
var eventsData = {};
|
303
|
-
form.fileupload('option', {
|
304
|
-
pasteZone: document,
|
305
|
-
dragover: function () {
|
306
|
-
eventsData.dragover = true;
|
307
|
-
},
|
308
|
-
dragenter: function () {
|
309
|
-
eventsData.dragenter = true;
|
310
|
-
},
|
311
|
-
dragleave: function () {
|
312
|
-
eventsData.dragleave = true;
|
313
|
-
},
|
314
|
-
drop: function (e, data) {
|
315
|
-
eventsData.drop = data;
|
316
|
-
},
|
317
|
-
paste: function (e, data) {
|
318
|
-
eventsData.paste = data;
|
319
|
-
},
|
320
|
-
change: function () {
|
321
|
-
eventsData.change = true;
|
322
|
-
}
|
323
|
-
});
|
324
|
-
form.fileupload('disable');
|
325
|
-
form.fileupload('enable');
|
326
|
-
form
|
327
|
-
.fileupload('option', 'fileInput')
|
328
|
-
.trigger($.Event('change', eventObject));
|
329
|
-
expect(eventsData.change).to.equal(true);
|
330
|
-
form
|
331
|
-
.fileupload('option', 'dropZone')
|
332
|
-
.trigger($.Event('dragover', eventObject))
|
333
|
-
.trigger($.Event('dragenter', eventObject))
|
334
|
-
.trigger($.Event('dragleave', eventObject))
|
335
|
-
.trigger($.Event('drop', eventObject));
|
336
|
-
expect(eventsData.dragover).to.equal(true);
|
337
|
-
expect(eventsData.dragenter).to.equal(true);
|
338
|
-
expect(eventsData.dragleave).to.equal(true);
|
339
|
-
expect(eventsData.drop.files).to.deep.equal(files);
|
340
|
-
form
|
341
|
-
.fileupload('option', 'pasteZone')
|
342
|
-
.trigger($.Event('paste', eventObject));
|
343
|
-
expect(eventsData.paste.files).to.deep.equal(files);
|
344
|
-
});
|
345
|
-
|
346
|
-
it('option', function () {
|
347
|
-
var eventsData = {};
|
348
|
-
form.fileupload('option', 'drop', function (e, data) {
|
349
|
-
eventsData.drop = data;
|
350
|
-
});
|
351
|
-
var dropZone = form
|
352
|
-
.fileupload('option', 'dropZone')
|
353
|
-
.trigger($.Event('drop', eventObject));
|
354
|
-
expect(eventsData.drop.files).to.deep.equal(files);
|
355
|
-
delete eventsData.drop;
|
356
|
-
form.fileupload('option', 'dropZone', null);
|
357
|
-
dropZone.trigger($.Event('drop', eventObject));
|
358
|
-
expect(eventsData.drop).to.equal();
|
359
|
-
form.fileupload('option', {
|
360
|
-
dropZone: dropZone
|
361
|
-
});
|
362
|
-
dropZone.trigger($.Event('drop', eventObject));
|
363
|
-
expect(eventsData.drop.files).to.deep.equal(files);
|
364
|
-
});
|
365
|
-
|
366
|
-
it('add', function () {
|
367
|
-
var eventData = [];
|
368
|
-
form.fileupload('option', 'add', function (e, data) {
|
369
|
-
eventData.push(data);
|
370
|
-
});
|
371
|
-
form.fileupload('add', { files: files });
|
372
|
-
expect(eventData.length).to.equal(2);
|
373
|
-
expect(eventData[0].files[0]).to.equal(files[0]);
|
374
|
-
expect(eventData[1].files[0]).to.equal(files[1]);
|
375
|
-
});
|
376
|
-
|
377
|
-
it('send', function (done) {
|
378
|
-
this.slow(200);
|
379
|
-
form.fileupload('send', { files: files }).complete(function (result) {
|
380
|
-
var uploadedFiles = result.responseJSON.files;
|
381
|
-
expect(uploadedFiles.length).to.equal(2);
|
382
|
-
expect(uploadedFiles[0].type).to.equal(files[0].type);
|
383
|
-
expect(uploadedFiles[0].error).to.equal();
|
384
|
-
expect(uploadedFiles[1].type).to.equal(files[1].type);
|
385
|
-
expect(uploadedFiles[1].error).to.equal();
|
386
|
-
done();
|
387
|
-
});
|
388
|
-
});
|
389
|
-
});
|
390
|
-
|
391
|
-
describe('Callbacks', function () {
|
392
|
-
var form;
|
393
|
-
|
394
|
-
beforeEach(function () {
|
395
|
-
form = createFileuploadForm().fileupload({ dataType: 'json' });
|
396
|
-
});
|
397
|
-
|
398
|
-
afterEach(function () {
|
399
|
-
form.remove();
|
400
|
-
});
|
401
|
-
|
402
|
-
it('add', function () {
|
403
|
-
var eventData = [];
|
404
|
-
form.fileupload('option', 'add', function (e, data) {
|
405
|
-
eventData.push(data);
|
406
|
-
});
|
407
|
-
form.fileupload('add', { files: files });
|
408
|
-
expect(eventData.length).to.equal(2);
|
409
|
-
expect(eventData[0].files[0]).to.equal(files[0]);
|
410
|
-
expect(eventData[1].files[0]).to.equal(files[1]);
|
411
|
-
});
|
412
|
-
|
413
|
-
it('submit', function (done) {
|
414
|
-
this.slow(200);
|
415
|
-
var eventData = [];
|
416
|
-
form.fileupload('option', {
|
417
|
-
submit: function (e, data) {
|
418
|
-
eventData.push(data);
|
419
|
-
},
|
420
|
-
stop: function () {
|
421
|
-
if (eventData.length < 2) return;
|
422
|
-
expect(eventData[0].files[0]).to.equal(files[0]);
|
423
|
-
expect(eventData[1].files[0]).to.equal(files[1]);
|
424
|
-
done();
|
425
|
-
}
|
426
|
-
});
|
427
|
-
form.fileupload('add', { files: files });
|
428
|
-
});
|
429
|
-
|
430
|
-
it('send', function (done) {
|
431
|
-
this.slow(200);
|
432
|
-
var eventData = [];
|
433
|
-
form.fileupload('option', {
|
434
|
-
send: function (e, data) {
|
435
|
-
eventData.push(data);
|
436
|
-
},
|
437
|
-
stop: function () {
|
438
|
-
expect(eventData.length).to.equal(1);
|
439
|
-
expect(eventData[0].files).to.deep.equal(files);
|
440
|
-
done();
|
441
|
-
}
|
442
|
-
});
|
443
|
-
form.fileupload('send', { files: files });
|
444
|
-
});
|
445
|
-
|
446
|
-
it('done', function (done) {
|
447
|
-
this.slow(200);
|
448
|
-
var eventData = [];
|
449
|
-
form.fileupload('option', {
|
450
|
-
done: function (e, data) {
|
451
|
-
eventData.push(data);
|
452
|
-
},
|
453
|
-
stop: function () {
|
454
|
-
if (eventData.length < 2) return;
|
455
|
-
expect(eventData[0].result.files.length).to.equal(1);
|
456
|
-
expect(eventData[1].result.files.length).to.equal(1);
|
457
|
-
done();
|
458
|
-
}
|
459
|
-
});
|
460
|
-
form.fileupload('add', { files: files });
|
461
|
-
});
|
462
|
-
|
463
|
-
it('fail', function (done) {
|
464
|
-
this.slow(200);
|
465
|
-
var eventData = [];
|
466
|
-
form.fileupload('option', {
|
467
|
-
url: uploadURL + '404',
|
468
|
-
fail: function (e, data) {
|
469
|
-
eventData.push(data);
|
470
|
-
},
|
471
|
-
stop: function () {
|
472
|
-
if (eventData.length < 2) return;
|
473
|
-
expect(eventData[0].result).to.equal();
|
474
|
-
expect(eventData[1].result).to.equal();
|
475
|
-
done();
|
476
|
-
}
|
477
|
-
});
|
478
|
-
form.fileupload('add', { files: files });
|
479
|
-
});
|
480
|
-
|
481
|
-
it('always', function (done) {
|
482
|
-
this.slow(200);
|
483
|
-
var eventData = [];
|
484
|
-
form.fileupload('option', {
|
485
|
-
always: function (e, data) {
|
486
|
-
eventData.push(data);
|
487
|
-
},
|
488
|
-
stop: function () {
|
489
|
-
if (eventData.length < 2) {
|
490
|
-
expect(eventData[0].result).to.equal();
|
491
|
-
form.fileupload('add', { files: [fileGIF] });
|
492
|
-
return;
|
493
|
-
}
|
494
|
-
expect(eventData[1].result.files.length).to.equal(1);
|
495
|
-
done();
|
496
|
-
}
|
497
|
-
});
|
498
|
-
form.fileupload('add', { files: [fileGIF], url: uploadURL + '404' });
|
499
|
-
});
|
500
|
-
|
501
|
-
it('progress', function (done) {
|
502
|
-
this.slow(200);
|
503
|
-
var loaded;
|
504
|
-
var total;
|
505
|
-
form.fileupload('option', {
|
506
|
-
progress: function (e, data) {
|
507
|
-
loaded = data.loaded;
|
508
|
-
total = data.total;
|
509
|
-
expect(loaded).to.be.at.most(total);
|
510
|
-
},
|
511
|
-
stop: function () {
|
512
|
-
expect(loaded).to.equal(total);
|
513
|
-
done();
|
514
|
-
}
|
515
|
-
});
|
516
|
-
form.fileupload('add', { files: [fileGIF] });
|
517
|
-
});
|
518
|
-
|
519
|
-
it('progressall', function (done) {
|
520
|
-
this.slow(200);
|
521
|
-
var loaded;
|
522
|
-
var total;
|
523
|
-
var completed = 0;
|
524
|
-
form.fileupload('option', {
|
525
|
-
progressall: function (e, data) {
|
526
|
-
loaded = data.loaded;
|
527
|
-
total = data.total;
|
528
|
-
expect(loaded).to.be.at.most(total);
|
529
|
-
},
|
530
|
-
always: function () {
|
531
|
-
completed++;
|
532
|
-
},
|
533
|
-
stop: function () {
|
534
|
-
if (completed < 2) return;
|
535
|
-
expect(loaded).to.equal(total);
|
536
|
-
done();
|
537
|
-
}
|
538
|
-
});
|
539
|
-
form.fileupload('add', { files: files });
|
540
|
-
});
|
541
|
-
|
542
|
-
it('start', function (done) {
|
543
|
-
this.slow(200);
|
544
|
-
var started;
|
545
|
-
form.fileupload('option', {
|
546
|
-
start: function () {
|
547
|
-
started = true;
|
548
|
-
},
|
549
|
-
stop: function () {
|
550
|
-
expect(started).to.equal(true);
|
551
|
-
done();
|
552
|
-
}
|
553
|
-
});
|
554
|
-
form.fileupload('add', { files: [fileGIF] });
|
555
|
-
});
|
556
|
-
|
557
|
-
it('stop', function (done) {
|
558
|
-
this.slow(200);
|
559
|
-
form.fileupload('option', {
|
560
|
-
stop: function () {
|
561
|
-
done();
|
562
|
-
}
|
563
|
-
});
|
564
|
-
form.fileupload('add', { files: [fileGIF] });
|
565
|
-
});
|
566
|
-
|
567
|
-
it('dragover', function () {
|
568
|
-
var eventsData = {};
|
569
|
-
form.fileupload('option', {
|
570
|
-
autoUpload: false,
|
571
|
-
dragover: function () {
|
572
|
-
eventsData.dragover = true;
|
573
|
-
}
|
574
|
-
});
|
575
|
-
form
|
576
|
-
.fileupload('option', 'dropZone')
|
577
|
-
.trigger($.Event('dragover', eventObject));
|
578
|
-
expect(eventsData.dragover).to.equal(true);
|
579
|
-
});
|
580
|
-
|
581
|
-
it('dragenter', function () {
|
582
|
-
var eventsData = {};
|
583
|
-
form.fileupload('option', {
|
584
|
-
autoUpload: false,
|
585
|
-
dragenter: function () {
|
586
|
-
eventsData.dragenter = true;
|
587
|
-
}
|
588
|
-
});
|
589
|
-
form
|
590
|
-
.fileupload('option', 'dropZone')
|
591
|
-
.trigger($.Event('dragenter', eventObject));
|
592
|
-
expect(eventsData.dragenter).to.equal(true);
|
593
|
-
});
|
594
|
-
|
595
|
-
it('dragleave', function () {
|
596
|
-
var eventsData = {};
|
597
|
-
form.fileupload('option', {
|
598
|
-
autoUpload: false,
|
599
|
-
dragleave: function () {
|
600
|
-
eventsData.dragleave = true;
|
601
|
-
}
|
602
|
-
});
|
603
|
-
form
|
604
|
-
.fileupload('option', 'dropZone')
|
605
|
-
.trigger($.Event('dragleave', eventObject));
|
606
|
-
expect(eventsData.dragleave).to.equal(true);
|
607
|
-
});
|
608
|
-
|
609
|
-
it('drop', function () {
|
610
|
-
var eventsData = {};
|
611
|
-
form.fileupload('option', {
|
612
|
-
autoUpload: false,
|
613
|
-
drop: function (e, data) {
|
614
|
-
eventsData.drop = data;
|
615
|
-
}
|
616
|
-
});
|
617
|
-
form
|
618
|
-
.fileupload('option', 'dropZone')
|
619
|
-
.trigger($.Event('drop', eventObject));
|
620
|
-
expect(eventsData.drop.files).to.deep.equal(files);
|
621
|
-
});
|
622
|
-
|
623
|
-
it('paste', function () {
|
624
|
-
var eventsData = {};
|
625
|
-
form.fileupload('option', {
|
626
|
-
autoUpload: false,
|
627
|
-
pasteZone: document,
|
628
|
-
paste: function (e, data) {
|
629
|
-
eventsData.paste = data;
|
630
|
-
}
|
631
|
-
});
|
632
|
-
form
|
633
|
-
.fileupload('option', 'pasteZone')
|
634
|
-
.trigger($.Event('paste', eventObject));
|
635
|
-
expect(eventsData.paste.files).to.deep.equal(files);
|
636
|
-
});
|
637
|
-
|
638
|
-
it('change', function () {
|
639
|
-
var eventsData = {};
|
640
|
-
form.fileupload('option', {
|
641
|
-
autoUpload: false,
|
642
|
-
change: function () {
|
643
|
-
eventsData.change = true;
|
644
|
-
}
|
645
|
-
});
|
646
|
-
form
|
647
|
-
.fileupload('option', 'fileInput')
|
648
|
-
.trigger($.Event('change', eventObject));
|
649
|
-
expect(eventsData.change).to.equal(true);
|
650
|
-
});
|
651
|
-
});
|
652
|
-
|
653
|
-
describe('Options', function () {
|
654
|
-
var form;
|
655
|
-
|
656
|
-
beforeEach(function () {
|
657
|
-
form = createFileuploadForm();
|
658
|
-
});
|
659
|
-
|
660
|
-
afterEach(function () {
|
661
|
-
form.remove();
|
662
|
-
});
|
663
|
-
|
664
|
-
it('paramName', function (done) {
|
665
|
-
form.fileupload({
|
666
|
-
send: function (e, data) {
|
667
|
-
expect(data.paramName[0]).to.equal(
|
668
|
-
form.fileupload('option', 'fileInput').prop('name')
|
669
|
-
);
|
670
|
-
done();
|
671
|
-
return false;
|
672
|
-
}
|
673
|
-
});
|
674
|
-
form.fileupload('add', { files: [fileGIF] });
|
675
|
-
});
|
676
|
-
|
677
|
-
it('url', function (done) {
|
678
|
-
form.fileupload({
|
679
|
-
send: function (e, data) {
|
680
|
-
expect(data.url).to.equal(form.prop('action'));
|
681
|
-
done();
|
682
|
-
return false;
|
683
|
-
}
|
684
|
-
});
|
685
|
-
form.fileupload('add', { files: [fileGIF] });
|
686
|
-
});
|
687
|
-
|
688
|
-
it('type', function (done) {
|
689
|
-
form.fileupload({
|
690
|
-
type: 'PUT',
|
691
|
-
send: function (e, data) {
|
692
|
-
expect(data.type).to.equal('PUT');
|
693
|
-
done();
|
694
|
-
return false;
|
695
|
-
}
|
696
|
-
});
|
697
|
-
form.fileupload('add', { files: [fileGIF] });
|
698
|
-
});
|
699
|
-
|
700
|
-
it('replaceFileInput', function () {
|
701
|
-
form.fileupload();
|
702
|
-
var fileInput = form.fileupload('option', 'fileInput');
|
703
|
-
fileInput.trigger($.Event('change', eventObject));
|
704
|
-
expect(form.fileupload('option', 'fileInput')[0]).to.not.equal(
|
705
|
-
fileInput[0]
|
706
|
-
);
|
707
|
-
form.fileupload('option', 'replaceFileInput', false);
|
708
|
-
fileInput = form.fileupload('option', 'fileInput');
|
709
|
-
fileInput.trigger($.Event('change', eventObject));
|
710
|
-
expect(form.fileupload('option', 'fileInput')[0]).to.equal(fileInput[0]);
|
711
|
-
});
|
712
|
-
|
713
|
-
it('forceIframeTransport', function (done) {
|
714
|
-
form.fileupload({
|
715
|
-
forceIframeTransport: 'PUT',
|
716
|
-
send: function (e, data) {
|
717
|
-
expect(data.dataType.substr(0, 6)).to.equal('iframe');
|
718
|
-
done();
|
719
|
-
return false;
|
720
|
-
}
|
721
|
-
});
|
722
|
-
form.fileupload('add', { files: [fileGIF] });
|
723
|
-
});
|
724
|
-
|
725
|
-
it('singleFileUploads', function (done) {
|
726
|
-
form.fileupload({
|
727
|
-
singleFileUploads: false,
|
728
|
-
send: function (e, data) {
|
729
|
-
expect(data.files).to.deep.equal(files);
|
730
|
-
done();
|
731
|
-
return false;
|
732
|
-
}
|
733
|
-
});
|
734
|
-
form.fileupload('add', { files: files });
|
735
|
-
});
|
736
|
-
|
737
|
-
it('limitMultiFileUploads', function (done) {
|
738
|
-
var completed = 0;
|
739
|
-
form.fileupload({
|
740
|
-
singleFileUploads: false,
|
741
|
-
limitMultiFileUploads: 2,
|
742
|
-
send: function (e, data) {
|
743
|
-
expect(data.files).to.deep.equal(files);
|
744
|
-
completed++;
|
745
|
-
if (completed < 2) return;
|
746
|
-
done();
|
747
|
-
return false;
|
748
|
-
}
|
749
|
-
});
|
750
|
-
form.fileupload('add', { files: files.concat(files) });
|
751
|
-
});
|
752
|
-
|
753
|
-
it('limitMultiFileUploadSize', function (done) {
|
754
|
-
var completed = 0;
|
755
|
-
form.fileupload({
|
756
|
-
singleFileUploads: false,
|
757
|
-
limitMultiFileUploadSize: files[0].size + files[1].size,
|
758
|
-
limitMultiFileUploadSizeOverhead: 0,
|
759
|
-
send: function (e, data) {
|
760
|
-
expect(data.files).to.deep.equal(files);
|
761
|
-
completed++;
|
762
|
-
if (completed < 2) return;
|
763
|
-
done();
|
764
|
-
return false;
|
765
|
-
}
|
766
|
-
});
|
767
|
-
form.fileupload('add', { files: files.concat(files) });
|
768
|
-
});
|
769
|
-
|
770
|
-
it('sequentialUploads', function (done) {
|
771
|
-
this.slow(400);
|
772
|
-
var completed = 0;
|
773
|
-
var events = [];
|
774
|
-
form.fileupload({
|
775
|
-
sequentialUploads: true,
|
776
|
-
dataType: 'json',
|
777
|
-
send: function () {
|
778
|
-
events.push('send');
|
779
|
-
},
|
780
|
-
always: function () {
|
781
|
-
events.push('complete');
|
782
|
-
completed++;
|
783
|
-
},
|
784
|
-
stop: function () {
|
785
|
-
if (completed === 4) {
|
786
|
-
expect(events.join(',')).to.equal(
|
787
|
-
[
|
788
|
-
'send',
|
789
|
-
'complete',
|
790
|
-
'send',
|
791
|
-
'complete',
|
792
|
-
'send',
|
793
|
-
'complete',
|
794
|
-
'send',
|
795
|
-
'complete'
|
796
|
-
].join(',')
|
797
|
-
);
|
798
|
-
done();
|
799
|
-
}
|
800
|
-
}
|
801
|
-
});
|
802
|
-
form.fileupload('add', { files: files.concat(files) });
|
803
|
-
});
|
804
|
-
|
805
|
-
it('limitConcurrentUploads', function (done) {
|
806
|
-
this.slow(800);
|
807
|
-
var completed = 0;
|
808
|
-
var loadCount = 0;
|
809
|
-
form.fileupload({
|
810
|
-
limitConcurrentUploads: 2,
|
811
|
-
dataType: 'json',
|
812
|
-
send: function () {
|
813
|
-
loadCount++;
|
814
|
-
expect(loadCount).to.be.at.most(2);
|
815
|
-
},
|
816
|
-
always: function () {
|
817
|
-
completed++;
|
818
|
-
loadCount--;
|
819
|
-
},
|
820
|
-
stop: function () {
|
821
|
-
if (completed === 8) {
|
822
|
-
done();
|
823
|
-
}
|
824
|
-
}
|
825
|
-
});
|
826
|
-
form.fileupload('add', {
|
827
|
-
files: files.concat(files).concat(files).concat(files)
|
828
|
-
});
|
829
|
-
});
|
830
|
-
|
831
|
-
it('multipart', function (done) {
|
832
|
-
form.fileupload({
|
833
|
-
multipart: false,
|
834
|
-
send: function (e, data) {
|
835
|
-
expect(data.contentType).to.equal(fileGIF.type);
|
836
|
-
expect(data.headers['Content-Disposition']).to.equal(
|
837
|
-
'attachment; filename="' + fileGIF.name + '"'
|
838
|
-
);
|
839
|
-
done();
|
840
|
-
return false;
|
841
|
-
}
|
842
|
-
});
|
843
|
-
form.fileupload('add', { files: [fileGIF] });
|
844
|
-
});
|
845
|
-
|
846
|
-
it('uniqueFilenames', function (done) {
|
847
|
-
form.fileupload({
|
848
|
-
uniqueFilenames: {},
|
849
|
-
send: function (e, data) {
|
850
|
-
var formFiles = data.data.getAll('files[]');
|
851
|
-
expect(formFiles[0].name).to.equal(fileGIF.name);
|
852
|
-
expect(formFiles[1].name).to.equal(
|
853
|
-
fileGIF.name.replace('.gif', ' (1).gif')
|
854
|
-
);
|
855
|
-
expect(formFiles[2].name).to.equal(
|
856
|
-
fileGIF.name.replace('.gif', ' (2).gif')
|
857
|
-
);
|
858
|
-
done();
|
859
|
-
return false;
|
860
|
-
}
|
861
|
-
});
|
862
|
-
form.fileupload('send', { files: [fileGIF, fileGIF, fileGIF] });
|
863
|
-
});
|
864
|
-
|
865
|
-
it('maxChunkSize', function (done) {
|
866
|
-
this.slow(400);
|
867
|
-
var events = [];
|
868
|
-
form.fileupload({
|
869
|
-
maxChunkSize: 32,
|
870
|
-
dataType: 'json',
|
871
|
-
chunkbeforesend: function () {
|
872
|
-
events.push('chunkbeforesend');
|
873
|
-
},
|
874
|
-
chunksend: function () {
|
875
|
-
events.push('chunksend');
|
876
|
-
},
|
877
|
-
chunkdone: function () {
|
878
|
-
events.push('chunkdone');
|
879
|
-
},
|
880
|
-
done: function (e, data) {
|
881
|
-
var uploadedFile = data.result.files[0];
|
882
|
-
expect(uploadedFile.type).to.equal(fileGIF.type);
|
883
|
-
expect(uploadedFile.size).to.equal(fileGIF.size);
|
884
|
-
},
|
885
|
-
stop: function () {
|
886
|
-
expect(events.join(',')).to.equal(
|
887
|
-
[
|
888
|
-
'chunkbeforesend',
|
889
|
-
'chunksend',
|
890
|
-
'chunkdone',
|
891
|
-
'chunkbeforesend',
|
892
|
-
'chunksend',
|
893
|
-
'chunkdone',
|
894
|
-
'chunkbeforesend',
|
895
|
-
'chunksend',
|
896
|
-
'chunkdone',
|
897
|
-
'chunkbeforesend',
|
898
|
-
'chunksend',
|
899
|
-
'chunkdone'
|
900
|
-
].join(',')
|
901
|
-
);
|
902
|
-
done();
|
903
|
-
}
|
904
|
-
});
|
905
|
-
form.fileupload('send', { files: [fileGIF] });
|
906
|
-
});
|
907
|
-
|
908
|
-
it('acceptFileTypes', function (done) {
|
909
|
-
var processData;
|
910
|
-
form.fileupload({
|
911
|
-
acceptFileTypes: /^image\/gif$/,
|
912
|
-
singleFileUploads: false,
|
913
|
-
processalways: function (e, data) {
|
914
|
-
processData = data;
|
915
|
-
},
|
916
|
-
processstop: function () {
|
917
|
-
expect(processData.files[0].error).to.equal();
|
918
|
-
expect(processData.files[1].error).to.equal(
|
919
|
-
form.fileupload('option').i18n('acceptFileTypes')
|
920
|
-
);
|
921
|
-
done();
|
922
|
-
}
|
923
|
-
});
|
924
|
-
form.fileupload('add', { files: files });
|
925
|
-
});
|
926
|
-
|
927
|
-
it('maxFileSize', function (done) {
|
928
|
-
var processData;
|
929
|
-
form.fileupload({
|
930
|
-
maxFileSize: 200,
|
931
|
-
singleFileUploads: false,
|
932
|
-
processalways: function (e, data) {
|
933
|
-
processData = data;
|
934
|
-
},
|
935
|
-
processstop: function () {
|
936
|
-
expect(processData.files[0].error).to.equal();
|
937
|
-
expect(processData.files[1].error).to.equal(
|
938
|
-
form.fileupload('option').i18n('maxFileSize')
|
939
|
-
);
|
940
|
-
done();
|
941
|
-
}
|
942
|
-
});
|
943
|
-
form.fileupload('add', { files: files });
|
944
|
-
});
|
945
|
-
|
946
|
-
it('minFileSize', function (done) {
|
947
|
-
var processData;
|
948
|
-
form.fileupload({
|
949
|
-
minFileSize: 200,
|
950
|
-
singleFileUploads: false,
|
951
|
-
processalways: function (e, data) {
|
952
|
-
processData = data;
|
953
|
-
},
|
954
|
-
processstop: function () {
|
955
|
-
expect(processData.files[0].error).to.equal(
|
956
|
-
form.fileupload('option').i18n('minFileSize')
|
957
|
-
);
|
958
|
-
expect(processData.files[1].error).to.equal();
|
959
|
-
done();
|
960
|
-
}
|
961
|
-
});
|
962
|
-
form.fileupload('add', { files: files });
|
963
|
-
});
|
964
|
-
|
965
|
-
it('maxNumberOfFiles', function (done) {
|
966
|
-
var processData;
|
967
|
-
form.fileupload({
|
968
|
-
maxNumberOfFiles: 2,
|
969
|
-
getNumberOfFiles: function () {
|
970
|
-
return 2;
|
971
|
-
},
|
972
|
-
singleFileUploads: false,
|
973
|
-
processalways: function (e, data) {
|
974
|
-
processData = data;
|
975
|
-
},
|
976
|
-
processstop: function () {
|
977
|
-
expect(processData.files[0].error).to.equal(
|
978
|
-
form.fileupload('option').i18n('maxNumberOfFiles')
|
979
|
-
);
|
980
|
-
expect(processData.files[1].error).to.equal(
|
981
|
-
form.fileupload('option').i18n('maxNumberOfFiles')
|
982
|
-
);
|
983
|
-
done();
|
984
|
-
}
|
985
|
-
});
|
986
|
-
form.fileupload('add', { files: files });
|
987
|
-
});
|
988
|
-
});
|
989
|
-
})(this.chai.expect, this.jQuery);
|