Index: LayoutTests/fast/dom/ParentNode/prepend.html |
diff --git a/LayoutTests/fast/dom/ParentNode/prepend.html b/LayoutTests/fast/dom/ParentNode/prepend.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c32fd001234a10bee363b744152fdaee57f310fe |
--- /dev/null |
+++ b/LayoutTests/fast/dom/ParentNode/prepend.html |
@@ -0,0 +1,60 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<script> |
+ |
+function test_prepend(node, nodeName) { |
+ |
+ test(function() { |
+ var parent = node.cloneNode(); |
+ parent.prepend(); |
+ expected = ""; |
+ assert_equals(parent.innerHTML, expected); |
+ }, nodeName + '.prepend() with empty argument, on a parent having no child.'); |
+ |
+ test(function() { |
+ var parent = node.cloneNode(); |
+ parent.prepend(null); |
+ expected = 'null'; |
+ assert_equals(parent.innerHTML, expected); |
+ }, nodeName + '.prepend() with null as an argument, on a parent having no child.'); |
+ |
+ test(function() { |
+ var parent = node.cloneNode(); |
+ parent.prepend('text'); |
+ expected = 'text'; |
+ assert_equals(parent.innerHTML, expected); |
+ }, nodeName + '.prepend() with only text as an argument, on a parent having no child.'); |
+ |
+ test(function() { |
+ var parent = node.cloneNode(); |
+ var x = document.createElement('x'); |
+ parent.prepend(x); |
+ expected = '<x></x>'; |
+ assert_equals(parent.innerHTML, expected); |
+ }, nodeName + '.prepend() with only one element as an argument, on a parent having no child.'); |
+ |
+ test(function() { |
+ var parent = node.cloneNode(); |
+ var child = document.createElement('test'); |
+ parent.appendChild(child); |
+ parent.prepend(null); |
+ expected = 'null<test></test>'; |
+ assert_equals(parent.innerHTML, expected); |
+ }, nodeName + '.prepend() with null as an argument, on a parent having a child.'); |
+ |
+ test(function() { |
+ var parent = node.cloneNode(); |
+ var x = document.createElement('x'); |
+ var child = document.createElement('test'); |
+ parent.appendChild(child); |
+ parent.prepend(x, 'text'); |
+ expected = '<x></x>text<test></test>'; |
+ assert_equals(parent.innerHTML, expected); |
+ }, nodeName + '.prepend() with one element and text as argument, on a parent having a child.'); |
+} |
+ |
+test_prepend(document.createElement('div'), 'Element'); |
+ |
+</script> |
+</html> |