OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <script> |
| 5 |
| 6 function test_append(node, nodeName) { |
| 7 |
| 8 test(function() { |
| 9 var parent = node.cloneNode(); |
| 10 parent.append(); |
| 11 expected = ""; |
| 12 assert_equals(parent.innerHTML, expected); |
| 13 }, nodeName + '.append() with empty argument, on a parent having no child.'
); |
| 14 |
| 15 test(function() { |
| 16 var parent = node.cloneNode(); |
| 17 parent.append(null); |
| 18 expected = 'null'; |
| 19 assert_equals(parent.innerHTML, expected); |
| 20 }, nodeName + '.append() with null as an argument, on a parent having no ch
ild.'); |
| 21 |
| 22 test(function() { |
| 23 var parent = node.cloneNode(); |
| 24 parent.append('text'); |
| 25 expected = 'text'; |
| 26 assert_equals(parent.innerHTML, expected); |
| 27 }, nodeName + '.append() with only text as an argument, on a parent having
no child.'); |
| 28 |
| 29 test(function() { |
| 30 var parent = node.cloneNode(); |
| 31 var x = document.createElement('x'); |
| 32 parent.append(x); |
| 33 expected = '<x></x>'; |
| 34 assert_equals(parent.innerHTML, expected); |
| 35 }, nodeName + '.append() with only one element as an argument, on a parent
having no child.'); |
| 36 |
| 37 test(function() { |
| 38 var parent = node.cloneNode(); |
| 39 var child = document.createElement('test'); |
| 40 parent.appendChild(child); |
| 41 parent.append(null); |
| 42 expected = '<test></test>null'; |
| 43 assert_equals(parent.innerHTML, expected); |
| 44 }, nodeName + '.append() with null as an argument, on a parent having a chi
ld.'); |
| 45 |
| 46 test(function() { |
| 47 var parent = node.cloneNode(); |
| 48 var x = document.createElement('x'); |
| 49 var child = document.createElement('test'); |
| 50 parent.appendChild(child); |
| 51 parent.append(x, 'text'); |
| 52 expected = '<test></test><x></x>text'; |
| 53 assert_equals(parent.innerHTML, expected); |
| 54 }, nodeName + '.append() with one element and text as argument, on a parent
having a child.'); |
| 55 } |
| 56 |
| 57 test_append(document.createElement('div'), 'Element'); |
| 58 |
| 59 </script> |
| 60 </html> |
OLD | NEW |