mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Add a test for insertBefore(x, x), and move the test for replaceChild(x, x) to a better place.
This commit is contained in:
parent
0b680dc9bd
commit
b333501a46
2 changed files with 14 additions and 2 deletions
|
@ -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");
|
||||
</script>
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue