-
Notifications
You must be signed in to change notification settings - Fork 78
/
tests.js
33 lines (28 loc) · 1.04 KB
/
tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
$(document).ready(function(){
module("FormData");
test("FormData exist", function() {
ok(window.FormData);
});
test("add bad fake property", function() {
var data = new FormData();
ok(data.fake);
});
test("append simple value", function() {
var data = new FormData();
data.append('chuck', 'norris');
data.boundary = '-a';
equal(data, "---a\r\nContent-Disposition: form-data; name=\"chuck\";\r\n\r\nnorris\r\n---a--", "body should correctly formatted");
});
test("append file", function() {
var data = new FormData();
data.append('chuck', {
name: "norris.pdf",
type: "application/pdf",
getAsBinary: function() {
return 'norris';
}
});
data.boundary = '-a';
equal(data, "---a\r\nContent-Disposition: form-data; name=\"chuck\"; filename=\"norris.pdf\"\r\nContent-Type: application/pdf\r\n\r\nnorris\r\n---a--", "body should correctly formatted");
});
});