mirror of
https://github.com/servo/servo.git
synced 2025-08-16 19:05:33 +01:00
Update web-platform-tests to revision 4a5223502fa660ce03e470af6a61c8bc26c5a8ee
This commit is contained in:
parent
c5f7c9ccf3
commit
e891345f26
1328 changed files with 36632 additions and 20588 deletions
|
@ -36,4 +36,48 @@ test(function() {
|
|||
assert_unreached(i);
|
||||
}
|
||||
}, "empty");
|
||||
|
||||
test(function() {
|
||||
const url = new URL("http://localhost/query?param0=0¶m1=1¶m2=2");
|
||||
const searchParams = url.searchParams;
|
||||
const seen = [];
|
||||
for (const param of searchParams) {
|
||||
if (param[0] === 'param0') {
|
||||
searchParams.delete('param1');
|
||||
}
|
||||
seen.push(param);
|
||||
}
|
||||
|
||||
assert_array_equals(seen[0], ["param0", "0"]);
|
||||
assert_array_equals(seen[1], ["param2", "2"]);
|
||||
}, "delete next param during iteration");
|
||||
|
||||
test(function() {
|
||||
const url = new URL("http://localhost/query?param0=0¶m1=1¶m2=2");
|
||||
const searchParams = url.searchParams;
|
||||
const seen = [];
|
||||
for (const param of searchParams) {
|
||||
if (param[0] === 'param0') {
|
||||
searchParams.delete('param0');
|
||||
// 'param1=1' is now in the first slot, so the next iteration will see 'param2=2'.
|
||||
} else {
|
||||
seen.push(param);
|
||||
}
|
||||
}
|
||||
|
||||
assert_array_equals(seen[0], ["param2", "2"]);
|
||||
}, "delete current param during iteration");
|
||||
|
||||
test(function() {
|
||||
const url = new URL("http://localhost/query?param0=0¶m1=1¶m2=2");
|
||||
const searchParams = url.searchParams;
|
||||
const seen = [];
|
||||
for (const param of searchParams) {
|
||||
seen.push(param[0]);
|
||||
searchParams.delete(param[0]);
|
||||
}
|
||||
|
||||
assert_array_equals(seen, ["param0", "param2"], "param1 should not have been seen by the loop");
|
||||
assert_equals(String(searchParams), "param1=1", "param1 should remain");
|
||||
}, "delete every param seen during iteration");
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue