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