summaryrefslogtreecommitdiffstats
path: root/test/wpt/tests/xhr/formdata/get.any.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/wpt/tests/xhr/formdata/get.any.js')
-rw-r--r--test/wpt/tests/xhr/formdata/get.any.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/wpt/tests/xhr/formdata/get.any.js b/test/wpt/tests/xhr/formdata/get.any.js
new file mode 100644
index 0000000..b307f1e
--- /dev/null
+++ b/test/wpt/tests/xhr/formdata/get.any.js
@@ -0,0 +1,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;
+ }