| Index: LayoutTests/fast/dom/ChildNode/before.html
|
| diff --git a/LayoutTests/fast/dom/ChildNode/before.html b/LayoutTests/fast/dom/ChildNode/before.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..90017b4bbe067e553dfb4176cf1d98285f4377cd
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/dom/ChildNode/before.html
|
| @@ -0,0 +1,85 @@
|
| +<!DOCTYPE html>
|
| +<script src="../../../resources/testharness.js"></script>
|
| +<script src="../../../resources/testharnessreport.js"></script>
|
| +<script>
|
| +
|
| +test(function() {
|
| + var node = document.createComment('node');
|
| + assert_true('before' in node);
|
| + assert_equals(typeof node.after, 'function');
|
| + assert_equals(node.before.length, 0);
|
| +}, "Comment should support before()");
|
| +
|
| +test(function() {
|
| + var node = document.createElement('node');
|
| + assert_true('before' in node);
|
| + assert_equals(typeof node.after, 'function');
|
| + assert_equals(node.before.length, 0);
|
| +}, "Element should support before()");
|
| +
|
| +test(function() {
|
| + var node = document.createTextNode('node');
|
| + assert_true('before' in node);
|
| + assert_equals(typeof node.after, 'function');
|
| + assert_equals(node.before.length, 0);
|
| +}, "Text should support before()");
|
| +
|
| +test(function() {
|
| + var parent = document.createElement('div');
|
| + var test = document.createComment('test');
|
| + parent.appendChild(test);
|
| + var x = document.createComment('x');
|
| + var z = document.createComment('z');
|
| +
|
| + test.before(x, 'y', z);
|
| +
|
| + assert_equals(parent.childNodes.length, 4, 'parent should have 4 children');
|
| + assert_equals(parent.firstChild, x, 'parent\'s first child should be x');
|
| + assert_equals(parent.childNodes[1].data, 'y', 'parent\'s second child should be "y"');
|
| + assert_equals(parent.childNodes[2], z, 'parent\'s third child should be z');
|
| + assert_equals(parent.lastChild, test, 'parent\'s last child should be test');
|
| +
|
| + x.before('a');
|
| + assert_equals(parent.firstChild.data, 'a', 'parent\'s first child should be "a"');
|
| +}, "before() should work for Comment");
|
| +
|
| +test(function() {
|
| + var parent = document.createElement('div');
|
| + var test = document.createComment('test');
|
| + parent.appendChild(test);
|
| + var x = document.createElement('x');
|
| + var z = document.createElement('z');
|
| +
|
| + test.before(x, 'y', z);
|
| +
|
| + assert_equals(parent.childNodes.length, 4, 'parent should have 4 children');
|
| + assert_equals(parent.firstChild, x, 'parent\'s first child should be x');
|
| + assert_equals(parent.childNodes[1].data, 'y', 'parent\'s second child should be "y"');
|
| + assert_equals(parent.childNodes[2], z, 'parent\'s third child should be z');
|
| + assert_equals(parent.lastChild, test, 'parent\'s last child should be test');
|
| +
|
| + x.before('a');
|
| + assert_equals(parent.firstChild.data, 'a', 'parent\'s first child should be "a"');
|
| +}, "before() should work for Element");
|
| +
|
| +test(function() {
|
| + var parent = document.createElement('div');
|
| + var test = document.createComment('test');
|
| + parent.appendChild(test);
|
| + var x = document.createTextNode('x');
|
| + var z = document.createTextNode('z');
|
| +
|
| + test.before(x, 'y', z);
|
| +
|
| + assert_equals(parent.childNodes.length, 4, 'parent should have 4 children');
|
| + assert_equals(parent.firstChild, x, 'parent\'s first child should be x');
|
| + assert_equals(parent.childNodes[1].data, 'y', 'parent\'s second child should be "y"');
|
| + assert_equals(parent.childNodes[2], z, 'parent\'s third child should be z');
|
| + assert_equals(parent.lastChild, test, 'parent\'s last child should be test');
|
| +
|
| + x.before('a');
|
| + assert_equals(parent.firstChild.data, 'a', 'parent\'s first child should be "a"');
|
| +}, "before() should work for Text");
|
| +
|
| +</script>
|
| +</html>
|
|
|