From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../web-platform/tests/xhr/formdata/append.any.js | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 testing/web-platform/tests/xhr/formdata/append.any.js (limited to 'testing/web-platform/tests/xhr/formdata/append.any.js') diff --git a/testing/web-platform/tests/xhr/formdata/append.any.js b/testing/web-platform/tests/xhr/formdata/append.any.js new file mode 100644 index 0000000000..fb365618d2 --- /dev/null +++ b/testing/web-platform/tests/xhr/formdata/append.any.js @@ -0,0 +1,37 @@ +// META: title=FormData.append + + test(function() { + assert_equals(create_formdata(['key', 'value1']).get('key'), "value1"); + }, 'testFormDataAppend1'); + test(function() { + assert_equals(create_formdata(['key', 'value2'], ['key', 'value1']).get('key'), "value2"); + }, 'testFormDataAppend2'); + test(function() { + assert_equals(create_formdata(['key', undefined]).get('key'), "undefined"); + }, 'testFormDataAppendUndefined1'); + test(function() { + assert_equals(create_formdata(['key', undefined], ['key', 'value1']).get('key'), "undefined"); + }, 'testFormDataAppendUndefined2'); + test(function() { + assert_equals(create_formdata(['key', null]).get('key'), "null"); + }, 'testFormDataAppendNull1'); + test(function() { + assert_equals(create_formdata(['key', null], ['key', 'value1']).get('key'), "null"); + }, 'testFormDataAppendNull2'); + test(function() { + var before = new Date(new Date().getTime() - 2000); // two seconds ago, in case there's clock drift + var fd = create_formdata(['key', new Blob(), 'blank.txt']).get('key'); + assert_equals(fd.name, "blank.txt"); + assert_equals(fd.type, ""); + assert_equals(fd.size, 0); + assert_greater_than_equal(fd.lastModified, before); + assert_less_than_equal(fd.lastModified, new Date()); + }, 'testFormDataAppendEmptyBlob'); + + function create_formdata() { + var fd = new FormData(); + for (var i = 0; i < arguments.length; i++) { + fd.append.apply(fd, arguments[i]); + }; + return fd; + } -- cgit v1.2.3