| 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..f28017cb04872c77a66226a06a6484db80949258
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/dom/ChildNode/before.html
|
| @@ -0,0 +1,68 @@
|
| +<!DOCTYPE html>
|
| +<script src="../../../resources/testharness.js"></script>
|
| +<script src="../../../resources/testharnessreport.js"></script>
|
| +<script>
|
| +
|
| +function test_before(node, 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 = node.cloneNode();
|
| + parent.appendChild(child);
|
| + child.before();
|
| + expected = innerHTML;
|
| + assert_equals(parent.innerHTML, expected);
|
| + }, nodeName + '.before() without any argument.');
|
| +
|
| + test(function() {
|
| + var parent = node.cloneNode();
|
| + parent.appendChild(child);
|
| + child.before(null);
|
| + expected = 'null' + innerHTML;
|
| + assert_equals(parent.innerHTML, expected);
|
| + }, nodeName + '.before() with null as an argument.');
|
| +
|
| + test(function() {
|
| + var parent = node.cloneNode();
|
| + parent.appendChild(child);
|
| + child.before('text');
|
| + expected = 'text' + innerHTML;
|
| + assert_equals(parent.innerHTML, expected);
|
| + }, nodeName + '.before() with only text as an argument.');
|
| +
|
| + test(function() {
|
| + var parent = node.cloneNode();
|
| + var x = document.createElement('x');
|
| + parent.appendChild(child);
|
| + child.before(x);
|
| + expected = '<x></x>' + innerHTML;
|
| + assert_equals(parent.innerHTML, expected);
|
| + }, nodeName + '.before() with only one element as an argument.');
|
| +
|
| + test(function() {
|
| + var parent = node.cloneNode();
|
| + var x = document.createElement('x');
|
| + parent.appendChild(child);
|
| + child.before(x, 'text');
|
| + expected = '<x></x>text' + innerHTML;
|
| + assert_equals(parent.innerHTML, expected);
|
| + }, nodeName + '.before() with one element and text as arguments.');
|
| +}
|
| +
|
| +test_before(document.createElement('div'), 'Comment');
|
| +test_before(document.createElement('div'), 'Element');
|
| +test_before(document.createElement('div'), 'Text');
|
| +
|
| +</script>
|
| +</html>
|
|
|