| 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>
|
|
|