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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/ChildNode/before.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
Index: third_party/WebKit/LayoutTests/fast/dom/ChildNode/before.html
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/ChildNode-before.html b/third_party/WebKit/LayoutTests/fast/dom/ChildNode/before.html
similarity index 65%
copy from third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/ChildNode-before.html
copy to third_party/WebKit/LayoutTests/fast/dom/ChildNode/before.html
index 0e5f45e8d365ff4a155a09eff00579f91555d7c4..ea4b82776b416c29e950a8500cf14ce945c4150c 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/ChildNode-before.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/ChildNode/before.html
@@ -1,12 +1,35 @@
<!DOCTYPE html>
-<meta charset=utf-8>
-<title>ChildNode.before</title>
-<link rel=help href="https://dom.spec.whatwg.org/#dom-childnode-before">
-<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_before(child, nodeName, innerHTML) {
+test(function () {
+ var child = document.createElement('p');
+ assert_true('before' in child);
+ var before = 'mine';
+ var getAttribute = 'mine';
+ with (child) {
+ assert_true(before === 'mine');
+ assert_false(getAttribute === 'mine');
+ }
+ assert_true('Symbol' in window);
+ var unscopables = Object.getPrototypeOf(child)[Symbol.unscopables];
+ assert_true(unscopables.before);
+}, 'ChildNode.before() unscopeable');
+
+function test_before(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_before(child, nodeName, innerHTML) {
}, nodeName + '.before() with context object itself as the argument.');
test(function() {
- var parent = document.createElement('div')
- var x = document.createElement('x');
- parent.appendChild(child);
- parent.appendChild(x);
- child.before(x, child);
- var expected = '<x></x>' + innerHTML;
- assert_equals(parent.innerHTML, expected);
- }, nodeName + '.before() 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_before(child, nodeName, innerHTML) {
}, nodeName + '.before() 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(x);
- parent.appendChild(y);
- parent.appendChild(z);
- parent.appendChild(child);
- child.before(y, z);
- var expected = '<x></x><y></y><z></z>' + innerHTML;
- 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(v);
- parent.appendChild(x);
- parent.appendChild(y);
- parent.appendChild(z);
- parent.appendChild(child);
- child.before(y, z);
- var expected = '<v></v><x></x><y></y><z></z>' + innerHTML;
- assert_equals(parent.innerHTML, expected);
- }, nodeName + '.before() 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_before(child, nodeName, innerHTML) {
}, nodeName + '.before() on a child without any parent.');
}
-test_before(document.createComment('test'), 'Comment', '<!--test-->');
-test_before(document.createElement('test'), 'Element', '<test></test>');
-test_before(document.createTextNode('test'), 'Text', 'test');
+test_before('Comment');
+test_before('Element');
+test_before('Text');
</script>
</html>

Powered by Google App Engine
This is Rietveld 408576698