Index: third_party/WebKit/LayoutTests/fast/dom/ChildNode/after.html |
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/ChildNode-after.html b/third_party/WebKit/LayoutTests/fast/dom/ChildNode/after.html |
similarity index 65% |
copy from third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/ChildNode-after.html |
copy to third_party/WebKit/LayoutTests/fast/dom/ChildNode/after.html |
index 6f3cf323d2fb64f9139c485a0e2a1884760d2024..77750e510e4ca3fb0f76264a430b4df7067d6fa5 100644 |
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/ChildNode-after.html |
+++ b/third_party/WebKit/LayoutTests/fast/dom/ChildNode/after.html |
@@ -1,12 +1,35 @@ |
<!DOCTYPE html> |
-<meta charset=utf-8> |
-<title>ChildNode.after</title> |
-<link rel=help href="https://dom.spec.whatwg.org/#dom-childnode-after"> |
-<script src="../../../../resources/testharness.js"></script> |
-<script src="../../../../resources/testharnessreport.js"></script> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
<script> |
-function test_after(child, nodeName, innerHTML) { |
+test(function () { |
+ var child = document.createElement('p'); |
+ assert_true('after' in child); |
+ var after = 'mine'; |
+ var getAttribute = 'mine'; |
+ with (child) { |
+ assert_true(after === 'mine'); |
+ assert_false(getAttribute === 'mine'); |
+ } |
+ assert_true('Symbol' in window); |
+ var unscopables = Object.getPrototypeOf(child)[Symbol.unscopables]; |
+ assert_true(unscopables.after); |
+}, 'ChildNode.after() unscopeable'); |
+ |
+function test_after(nodeName) { |
+ var child; |
+ var innerHTML; |
+ if (nodeName == 'Comment') { |
+ child = document.createComment('test'); |
+ innerHTML = '<!--test-->'; |
+ } else if (nodeName == 'Element') { |
+ child = document.createElement('test'); |
+ innerHTML = '<test></test>'; |
+ } else { |
+ child = document.createTextNode('test'); |
+ innerHTML = 'test'; |
+ } |
test(function() { |
var parent = document.createElement('div'); |
@@ -73,16 +96,6 @@ function test_after(child, nodeName, innerHTML) { |
}, nodeName + '.after() with context object itself as the argument.'); |
test(function() { |
- var parent = document.createElement('div') |
- var x = document.createElement('x'); |
- parent.appendChild(x); |
- parent.appendChild(child); |
- child.after(child, x); |
- var expected = innerHTML + '<x></x>'; |
- assert_equals(parent.innerHTML, expected); |
- }, nodeName + '.after() with context object itself and node as the arguments, switching positions.'); |
- |
- test(function() { |
var parent = document.createElement('div'); |
var x = document.createElement('x'); |
var y = document.createElement('y'); |
@@ -96,36 +109,6 @@ function test_after(child, nodeName, innerHTML) { |
}, nodeName + '.after() with all siblings of child as arguments.'); |
test(function() { |
- var parent = document.createElement('div') |
- var x = document.createElement('x'); |
- var y = document.createElement('y'); |
- var z = document.createElement('z'); |
- parent.appendChild(child); |
- parent.appendChild(x); |
- parent.appendChild(y); |
- parent.appendChild(z); |
- child.after(x, y); |
- var expected = innerHTML + '<x></x><y></y><z></z>'; |
- assert_equals(parent.innerHTML, expected); |
- }, nodeName + '.before() with some siblings of child as arguments; no changes in tree; viable sibling is first child.'); |
- |
- test(function() { |
- var parent = document.createElement('div') |
- var v = document.createElement('v'); |
- var x = document.createElement('x'); |
- var y = document.createElement('y'); |
- var z = document.createElement('z'); |
- parent.appendChild(child); |
- parent.appendChild(v); |
- parent.appendChild(x); |
- parent.appendChild(y); |
- parent.appendChild(z); |
- child.after(v, x); |
- var expected = innerHTML + '<v></v><x></x><y></y><z></z>'; |
- assert_equals(parent.innerHTML, expected); |
- }, nodeName + '.after() with some siblings of child as arguments; no changes in tree.'); |
- |
- test(function() { |
var parent = document.createElement('div'); |
var x = document.createElement('x'); |
var y = document.createElement('y'); |
@@ -158,9 +141,9 @@ function test_after(child, nodeName, innerHTML) { |
}, nodeName + '.after() on a child without any parent.'); |
} |
-test_after(document.createComment('test'), 'Comment', '<!--test-->'); |
-test_after(document.createElement('test'), 'Element', '<test></test>'); |
-test_after(document.createTextNode('test'), 'Text', 'test'); |
+test_after('Comment'); |
+test_after('Element'); |
+test_after('Text'); |
</script> |
</html> |