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

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

Issue 2783813003: Move tests for ChildNode and ParentNode to dom/child_node/ and dom/parent_node/. (Closed)
Patch Set: Created 3 years, 9 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/fast/dom/ChildNode/before.html b/third_party/WebKit/LayoutTests/fast/dom/ChildNode/before.html
deleted file mode 100644
index 00a1907df457a1053bc94543d1d5c0801db77c5a..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/fast/dom/ChildNode/before.html
+++ /dev/null
@@ -1,157 +0,0 @@
-<!DOCTYPE html>
-<script src="../../../resources/testharness.js"></script>
-<script src="../../../resources/testharnessreport.js"></script>
-<script>
-
-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() unscopable');
-
-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');
- parent.appendChild(child);
- child.before();
- assert_equals(parent.innerHTML, innerHTML);
- }, nodeName + '.before() without any argument.');
-
- test(function() {
- var parent = document.createElement('div');
- parent.appendChild(child);
- child.before(null);
- var expected = 'null' + innerHTML;
- assert_equals(parent.innerHTML, expected);
- }, nodeName + '.before() with null as an argument.');
-
- test(function() {
- var parent = document.createElement('div');
- parent.appendChild(child);
- child.before(undefined);
- var expected = 'undefined' + innerHTML;
- assert_equals(parent.innerHTML, expected);
- }, nodeName + '.before() with undefined as an argument.');
-
- test(function() {
- var parent = document.createElement('div');
- parent.appendChild(child);
- child.before('');
- assert_equals(parent.firstChild.data, '');
- }, nodeName + '.before() with the empty string as an argument.');
-
- test(function() {
- var parent = document.createElement('div');
- parent.appendChild(child);
- child.before('text');
- var expected = 'text' + innerHTML;
- assert_equals(parent.innerHTML, expected);
- }, nodeName + '.before() with only text as an argument.');
-
- test(function() {
- var parent = document.createElement('div');
- var x = document.createElement('x');
- parent.appendChild(child);
- child.before(x);
- var expected = '<x></x>' + innerHTML;
- assert_equals(parent.innerHTML, expected);
- }, nodeName + '.before() with only one element as an argument.');
-
- test(function() {
- var parent = document.createElement('div');
- var x = document.createElement('x');
- parent.appendChild(child);
- child.before(x, 'text');
- var expected = '<x></x>text' + innerHTML;
- assert_equals(parent.innerHTML, expected);
- }, nodeName + '.before() with one element and text as arguments.');
-
- test(function() {
- var parent = document.createElement('div');
- parent.appendChild(child);
- child.before('text', child);
- var expected = 'text' + innerHTML;
- assert_equals(parent.innerHTML, expected);
- }, nodeName + '.before() with context object itself as the argument.');
-
- test(function() {
- var parent = document.createElement('div');
- var x = document.createElement('x');
- var y = document.createElement('y');
- var z = document.createElement('z');
- parent.appendChild(y);
- parent.appendChild(child);
- parent.appendChild(x);
- child.before(x, y, z);
- var expected = '<x></x><y></y><z></z>' + innerHTML;
- assert_equals(parent.innerHTML, expected);
- }, 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');
- parent.appendChild(x);
- parent.appendChild(y);
- parent.appendChild(child);
- child.before(y, x);
- var expected = '<y></y><x></x>' + innerHTML;
- assert_equals(parent.innerHTML, expected);
- }, nodeName + '.before() when pre-insert behaves like prepend.');
-
- test(function() {
- var parent = document.createElement('div');
- var x = document.createElement('x');
- parent.appendChild(x);
- parent.appendChild(document.createTextNode('1'));
- var y = document.createElement('y');
- parent.appendChild(y);
- parent.appendChild(child);
- child.before(x, '2');
- var expected = '1<y></y><x></x>2' + innerHTML;
- assert_equals(parent.innerHTML, expected);
- }, nodeName + '.before() with one sibling of child and text as arguments.');
-
- test(function() {
- var x = document.createElement('x');
- var y = document.createElement('y');
- x.before(y);
- assert_equals(x.previousSibling, null);
- }, nodeName + '.before() on a child without any parent.');
-
- test(function() {
- var parent = document.createElement('div');
- parent.appendChild(child);
- var doc2 = document.implementation.createDocument("http://www.w3.org/1999/xhtml", "html");
- assert_throws('HierarchyRequestError', () => { child.before(doc2, "foo") });
- assert_equals(parent.firstChild, child);
- }, nodeName + '.before() with a Document as an argument should throw.');
-}
-
-test_before('Comment');
-test_before('Element');
-test_before('Text');
-
-</script>
-</html>

Powered by Google App Engine
This is Rietveld 408576698