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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/ChildNode/after.html

Issue 1934123002: Implement DOM methods: prepend, append, after, before and replaceWith. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync test expectations Created 4 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/ChildNode/before.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/dom/ChildNode/before.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698