Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4834

Show
Ignore:
Timestamp:
08/28/06 23:08:15 (2 years ago)
Author:
madrobby
Message:

Add additional unit tests to test/unit/dom.html for testing Element.update and $().update in various enviroments [Thomas Fuchs]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spinoffs/prototype/CHANGELOG

    r4236 r4834  
    11*SVN* 
     2 
     3* Add addtional unit tests to test/unit/dom.html for testing Element.update and $().update in various enviroments 
    24 
    35* Prevent possible exceptions on unloading the page in IE [Thomas Fuchs] 
  • spinoffs/prototype/test/unit/dom.html

    r4150 r4834  
    1818<h1>Prototype Unit test file</h1> 
    1919<p> 
    20   Test of functions in dom.js 
     20  Test of functions in dom.js 
    2121</p> 
    2222 
     
    3939  </table> 
    4040</div> 
     41 
     42<div id="testdiv">to be updated</div> 
    4143  
    4244<!-- Tests follow --> 
     
    4446// <![CDATA[ 
    4547 
     48  var testVar = 'to be updated'; 
     49 
    4650  new Test.Unit.Runner({ 
    4751     
    4852    testInsertWithTR: function() {with(this) { 
    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); 
    5185    }} 
    5286     
    5387  }, 'testlog'); 
     88 
    5489// ]]> 
    5590</script>