Update web-platform-tests to revision 4a5223502fa660ce03e470af6a61c8bc26c5a8ee

This commit is contained in:
WPT Sync Bot 2018-04-23 21:13:37 -04:00
parent c5f7c9ccf3
commit e891345f26
1328 changed files with 36632 additions and 20588 deletions

View file

@ -36,4 +36,48 @@ test(function() {
assert_unreached(i);
}
}, "empty");
test(function() {
const url = new URL("http://localhost/query?param0=0&param1=1&param2=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&param1=1&param2=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&param1=1&param2=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>