Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
114 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/wpt/metadata/XMLHttpRequest/formdata-foreach.html.ini
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[formdata-foreach.html] | ||
type: testharness | ||
[Iterator should return duplicate keys and non-deleted values] | ||
expected: FAIL | ||
|
||
[Entries iterator should return duplicate keys and non-deleted values] | ||
expected: FAIL | ||
|
||
[Keys iterator should return duplicates] | ||
expected: FAIL | ||
|
||
[Values iterator should return non-deleted values] | ||
expected: FAIL |
59 changes: 59 additions & 0 deletions
59
tests/wpt/web-platform-tests/XMLHttpRequest/formdata-foreach.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<!doctype html> | ||
<html lang=en> | ||
<meta charset=utf-8> | ||
<title>FormData: foreach</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<link rel="help" href="https://xhr.spec.whatwg.org/#interface-formdata" /> | ||
<script> | ||
var fd = new FormData(); | ||
fd.append('n1', 'v1'); | ||
fd.append('n2', 'v2'); | ||
fd.append('n3', 'v3'); | ||
fd.append('n1', 'v4'); | ||
fd.append('n2', 'v5'); | ||
fd.append('n3', 'v6'); | ||
fd.delete('n2'); | ||
var expected_keys = ['n1', 'n3', 'n1', 'n3']; | ||
var expected_values = ['v1', 'v3', 'v4', 'v6']; | ||
test(function() { | ||
var mykeys = [], myvalues = []; | ||
for(var entry of fd) { | ||
assert_equals(entry.length, 2, | ||
'Default iterator should yield key/value pairs'); | ||
mykeys.push(entry[0]); | ||
myvalues.push(entry[1]); | ||
} | ||
assert_array_equals(mykeys, expected_keys, | ||
'Default iterator should see duplicate keys'); | ||
assert_array_equals(myvalues, expected_values, | ||
'Default iterator should see non-deleted values'); | ||
}, 'Iterator should return duplicate keys and non-deleted values'); | ||
test(function() { | ||
var mykeys = [], myvalues = []; | ||
for(var entry of fd.entries()) { | ||
assert_equals(entry.length, 2, | ||
'entries() iterator should yield key/value pairs'); | ||
mykeys.push(entry[0]); | ||
myvalues.push(entry[1]); | ||
} | ||
assert_array_equals(mykeys, expected_keys, | ||
'entries() iterator should see duplicate keys'); | ||
assert_array_equals(myvalues, expected_values, | ||
'entries() iterator should see non-deleted values'); | ||
}, 'Entries iterator should return duplicate keys and non-deleted values'); | ||
test(function() { | ||
var mykeys = []; | ||
for(var entry of fd.keys()) | ||
mykeys.push(entry); | ||
assert_array_equals(mykeys, expected_keys, | ||
'keys() iterator should see duplicate keys'); | ||
}, 'Keys iterator should return duplicates'); | ||
test(function() { | ||
var myvalues = []; | ||
for(var entry of fd.values()) | ||
myvalues.push(entry); | ||
assert_array_equals(myvalues, expected_values, | ||
'values() iterator should see non-deleted values'); | ||
}, 'Values iterator should return non-deleted values'); | ||
</script> |