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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/ChildNode/replace-with.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/replace-with.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/ChildNode/replace-with.html b/third_party/WebKit/LayoutTests/fast/dom/ChildNode/replace-with.html
deleted file mode 100644
index 9e9560885cdbd5c26dd265115776ae757b547544..0000000000000000000000000000000000000000
--- a/third_party/WebKit/LayoutTests/fast/dom/ChildNode/replace-with.html
+++ /dev/null
@@ -1,142 +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('replaceWith' in child);
- var replaceWith = 'mine';
- var getAttribute = 'mine';
- with (child) {
- assert_true(replaceWith === 'mine');
- assert_false(getAttribute === 'mine');
- }
- assert_true('Symbol' in window);
- var unscopables = Object.getPrototypeOf(child)[Symbol.unscopables];
- assert_true(unscopables.replaceWith);
-}, 'ChildNode.replaceWith() unscopable');
-
-function test_replaceWith(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.replaceWith();
- assert_equals(parent.innerHTML, '');
- }, nodeName + '.replaceWith() without any argument.');
-
- test(function() {
- var parent = document.createElement('div');
- parent.appendChild(child);
- child.replaceWith(null);
- assert_equals(parent.innerHTML, 'null');
- }, nodeName + '.replaceWith() with null as an argument.');
-
- test(function() {
- var parent = document.createElement('div');
- parent.appendChild(child);
- child.replaceWith(undefined);
- assert_equals(parent.innerHTML, 'undefined');
- }, nodeName + '.replaceWith() with undefined as an argument.');
-
- test(function() {
- var parent = document.createElement('div');
- parent.appendChild(child);
- child.replaceWith('');
- assert_equals(parent.innerHTML, '');
- }, nodeName + '.replaceWith() with an empty string as an argument.');
-
- test(function() {
- var parent = document.createElement('div');
- parent.appendChild(child);
- child.replaceWith('text');
- assert_equals(parent.innerHTML, 'text');
- }, nodeName + '.replaceWith() with only text as an argument.');
-
- test(function() {
- var parent = document.createElement('div');
- var x = document.createElement('x');
- parent.appendChild(child);
- child.replaceWith(x);
- assert_equals(parent.innerHTML, '<x></x>');
- }, nodeName + '.replaceWith() with only one element as an 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.replaceWith(x, y, z);
- assert_equals(parent.innerHTML, '<x></x><y></y><z></z>');
- }, nodeName + '.replaceWith() with sibling of child as arguments.');
-
- test(function() {
- var parent = document.createElement('div');
- var x = document.createElement('x');
- parent.appendChild(child);
- parent.appendChild(x);
- parent.appendChild(document.createTextNode('1'));
- child.replaceWith(x, '2');
- assert_equals(parent.innerHTML,'<x></x>21');
- }, nodeName + '.replaceWith() with one sibling of child and text as arguments.');
-
- test(function() {
- var parent = document.createElement('div');
- var x = document.createElement('x');
- parent.appendChild(child);
- var innerHTML = parent.innerHTML;
- parent.appendChild(x);
- parent.appendChild(document.createTextNode('text'));
- child.replaceWith(x, child);
- assert_equals(parent.innerHTML,'<x></x>' + innerHTML + 'text');
- }, nodeName + '.replaceWith() with one sibling of child and child itself as arguments.');
-
- test(function() {
- var parent = document.createElement('div');
- var x = document.createElement('x');
- parent.appendChild(child);
- child.replaceWith(x, 'text');
- assert_equals(parent.innerHTML, '<x></x>text');
- }, nodeName + '.replaceWith() with one element and text 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);
- child.replaceWith(x, y);
- assert_equals(parent.innerHTML, '<x></x><y></y>');
- }, nodeName + '.replaceWith() on a parenless child with two elements as arguments.');
-
- 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.replaceWith(doc2, "foo") });
- assert_equals(parent.firstChild, child);
- }, nodeName + '.replaceWith() with a Document as an argument should throw.');
-}
-
-test_replaceWith('Comment');
-test_replaceWith('Element');
-test_replaceWith('Text');
-
-</script>
-</html>

Powered by Google App Engine
This is Rietveld 408576698