Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/dom/lists/DOMTokenList-iteration.html

Issue 2212873003: W3C auto test importer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/dom/lists/DOMTokenList-iteration.html
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/dom/lists/DOMTokenList-iteration.html b/third_party/WebKit/LayoutTests/imported/wpt/dom/lists/DOMTokenList-iteration.html
new file mode 100644
index 0000000000000000000000000000000000000000..1911f7bb32a6f449c45cc26e9ea68e120d486f7a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/imported/wpt/dom/lists/DOMTokenList-iteration.html
@@ -0,0 +1,48 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>DOMTokenList iteration: keys, values, etc.</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<span class=" a a b "></span>
+<script>
+ test(function() {
+ var list = document.querySelector("span").classList;
+ assert_array_equals([...list], ["a", "a", "b"]);
+
+ var keys = list.keys();
+ assert_false(keys instanceof Array);
+ keys = [...keys];
+ assert_array_equals(keys, [0, 1, 2]);
+
+ var values = list.values();
+ assert_false(values instanceof Array);
+ values = [...values];
+ assert_array_equals(values, ["a", "a", "b"]);
+
+ var entries = list.entries();
+ assert_false(entries instanceof Array);
+ entries = [...entries];
+ assert_equals(entries.length, keys.length);
+ assert_equals(entries.length, values.length);
+ for (var i = 0; i < entries.length; ++i) {
+ assert_array_equals(entries[i], [keys[i], values[i]]);
+ }
+
+ var cur = 0;
+ var thisObj = {};
+ list.forEach(function(value, key, listObj) {
+ assert_equals(listObj, list);
+ assert_equals(this, thisObj);
+ assert_equals(value, values[cur]);
+ assert_equals(key, keys[cur]);
+ cur++;
+ }, thisObj);
+ assert_equals(cur, entries.length);
+
+ assert_equals(list[Symbol.iterator], Array.prototype[Symbol.iterator]);
+ assert_equals(list.keys, Array.prototype.keys);
+ assert_equals(list.values, Array.prototype.values);
+ assert_equals(list.entries, Array.prototype.entries);
+ assert_equals(list.forEach, Array.prototype.forEach);
+ });
+</script>

Powered by Google App Engine
This is Rietveld 408576698