From b333501a46322c8cb3b48f9b6d5fbcd62c547583 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Sun, 28 Jun 2015 17:23:31 +0200 Subject: [PATCH] Add a test for insertBefore(x, x), and move the test for replaceChild(x, x) to a better place. --- .../dom/nodes/Node-insertBefore.html | 4 ++-- .../dom/nodes/Node-replaceChild.html | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/wpt/web-platform-tests/dom/nodes/Node-insertBefore.html b/tests/wpt/web-platform-tests/dom/nodes/Node-insertBefore.html index 5e8581472c3..a9fc83b5009 100644 --- a/tests/wpt/web-platform-tests/dom/nodes/Node-insertBefore.html +++ b/tests/wpt/web-platform-tests/dom/nodes/Node-insertBefore.html @@ -298,9 +298,9 @@ test(function() { a.appendChild(b); a.appendChild(c); assert_array_equals(a.childNodes, [b, c]); - assert_equals(a.replaceChild(b, b), b); + assert_equals(a.insertBefore(b, b), b); assert_array_equals(a.childNodes, [b, c]); - assert_equals(a.replaceChild(c, c), c); + assert_equals(a.insertBefore(c, c), c); assert_array_equals(a.childNodes, [b, c]); }, "Inserting a node before itself should not move the node"); diff --git a/tests/wpt/web-platform-tests/dom/nodes/Node-replaceChild.html b/tests/wpt/web-platform-tests/dom/nodes/Node-replaceChild.html index d429750f76e..11e2764872d 100644 --- a/tests/wpt/web-platform-tests/dom/nodes/Node-replaceChild.html +++ b/tests/wpt/web-platform-tests/dom/nodes/Node-replaceChild.html @@ -265,6 +265,18 @@ test(function() { assert_equals(a.replaceChild(d, c), c); assert_array_equals(a.childNodes, [b, d, e]); }, "Replacing a node with its next sibling should work (4 children)"); +test(function() { + var a = document.createElement("div"); + var b = document.createElement("div"); + var c = document.createElement("div"); + a.appendChild(b); + a.appendChild(c); + assert_array_equals(a.childNodes, [b, c]); + assert_equals(a.replaceChild(b, b), b); + assert_array_equals(a.childNodes, [b, c]); + assert_equals(a.replaceChild(c, c), c); + assert_array_equals(a.childNodes, [b, c]); +}, "Replacing a node with itself should not move the node"); // Step 7. test(function() {