fune/testing/web-platform/tests/webidl/ecmascript-binding/default-iterator-object.html
Weizhong Xia 0108376e76 Bug 1730216 [wpt PR 30551] - Rename WebIDL to webidl, a=testonly
Automatic update from web-platform-tests
Rename WebIDL to webidl

WebIDL is renamed to webidl at up stream. Do this also in chromium to
unblock wpt-importer. Wpt-importer should be able to handle such cases
in future.

Bug: 1247327
Change-Id: Ib9c4ca3f4da55c6a25e56bc730a846b6fa95563b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3151416
Reviewed-by: Xianzhu Wang <wangxianzhu@chromium.org>
Commit-Queue: Weizhong Xia <weizhong@google.com>
Cr-Commit-Position: refs/heads/main@{#920025}

--

wpt-commits: a370aad338d6ed743abb4d2c6ae84a7f1058558c
wpt-pr: 30551
2021-09-29 09:23:56 +00:00

27 lines
1.2 KiB
HTML

<!doctype html>
<meta charset="utf-8">
<title>Default iterator objects</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(() => {
const iterator1 = new URLSearchParams()[Symbol.iterator]();
const iterator2 = new URLSearchParams().keys();
const iterator3 = new URLSearchParams().values();
const iterator4 = new URLSearchParams().entries();
assert_equals(Object.getPrototypeOf(iterator1), Object.getPrototypeOf(iterator2));
assert_equals(Object.getPrototypeOf(iterator1), Object.getPrototypeOf(iterator3));
assert_equals(Object.getPrototypeOf(iterator1), Object.getPrototypeOf(iterator4));
}, "Default iterator objects for an interface have the same prototype");
test(() => {
const iterator = new URLSearchParams().entries();
assert_equals(Object.prototype.toString.call(iterator), "[object URLSearchParams Iterator]");
}, "Object.prototype.toString returns correct value");
test(() => {
const iterator = new URLSearchParams().entries();
assert_equals(iterator[Symbol.toStringTag], "URLSearchParams Iterator");
assert_equals(Object.getOwnPropertyDescriptor(iterator, Symbol.toStringTag), undefined);
}, "@@toStringTag has correct value from prototype");
</script>