| 49 | | new Insertion.After('second_row', '<tr id="third_row"><td>Third Row</td></tr>'); |
|---|
| 50 | | assert($('second_row').childOf('table')); |
|---|
| | 53 | new Insertion.After('second_row', '<tr id="third_row"><td>Third Row</td></tr>'); |
|---|
| | 54 | assert($('second_row').childOf('table')); |
|---|
| | 55 | }}, |
|---|
| | 56 | |
|---|
| | 57 | testElementUpdate: function() {with(this) { |
|---|
| | 58 | $('testdiv').update('hello from div!'); |
|---|
| | 59 | assertEqual('hello from div!',$('testdiv').innerHTML); |
|---|
| | 60 | |
|---|
| | 61 | Element.update('testdiv','another hello from div!'); |
|---|
| | 62 | assertEqual('another hello from div!',$('testdiv').innerHTML); |
|---|
| | 63 | }}, |
|---|
| | 64 | |
|---|
| | 65 | testElementUpdateWithScript: function() {with(this) { |
|---|
| | 66 | $('testdiv').update('hello from div!<script>testVar="hello!"</'+'script>'); |
|---|
| | 67 | assertEqual('hello from div!',$('testdiv').innerHTML); |
|---|
| | 68 | wait(100,function(){ |
|---|
| | 69 | assertEqual('hello!',testVar); |
|---|
| | 70 | |
|---|
| | 71 | Element.update('testdiv','another hello from div!\n<script>testVar="another hello!"</'+'script>\nhere it goes'); |
|---|
| | 72 | assertEqual('another hello from div!\n\nhere it goes',$('testdiv').innerHTML); |
|---|
| | 73 | wait(100,function(){ |
|---|
| | 74 | assertEqual('another hello!',testVar); |
|---|
| | 75 | }); |
|---|
| | 76 | }); |
|---|
| | 77 | }}, |
|---|
| | 78 | |
|---|
| | 79 | testElementUpdateInTable: function() {with(this) { |
|---|
| | 80 | $('second_row').update('<td id="i_am_a_td">test</td>'); |
|---|
| | 81 | assertEqual('test',$('i_am_a_td').innerHTML); |
|---|
| | 82 | |
|---|
| | 83 | Element.update('second_row','<td id="i_am_a_td">another test</td>'); |
|---|
| | 84 | assertEqual('another test',$('i_am_a_td').innerHTML); |
|---|