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
|
// META: title=FormData: get and getAll
test(function() {
assert_equals(create_formdata(['key', 'value1'], ['key', 'value2']).get('key'), "value1");
}, 'testFormDataGet');
test(function() {
assert_equals(create_formdata(['key', 'value1'], ['key', 'value2']).get('nil'), null);
}, 'testFormDataGetNull1');
test(function() {
assert_equals(create_formdata().get('key'), null);
}, 'testFormDataGetNull2');
test(function() {
assert_array_equals(create_formdata(['key', 'value1'], ['key', 'value2']).getAll('key'), ["value1", "value2"]);
}, 'testFormDataGetAll');
test(function() {
assert_array_equals(create_formdata(['key', 'value1'], ['key', 'value2']).getAll('nil'), []);
}, 'testFormDataGetAllEmpty1');
test(function() {
assert_array_equals(create_formdata().getAll('key'), []);
}, 'testFormDataGetAllEmpty2');
function create_formdata() {
var fd = new FormData();
for (var i = 0; i < arguments.length; i++) {
fd.append.apply(fd, arguments[i]);
};
return fd;
}
|