OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <meta charset="utf-8"> | 2 <meta charset="utf-8"> |
3 <title>Delete Row tests</title> | 3 <title>Delete Row tests</title> |
4 <script src="/resources/testharness.js"></script> | 4 <script src="/resources/testharness.js"></script> |
5 <script src="/resources/testharnessreport.js"></script> | 5 <script src="/resources/testharnessreport.js"></script> |
6 | 6 |
7 <table id="element"> | 7 <table id="element"> |
8 <thead> | 8 <thead> |
9 <th>First column</th> | 9 <th>First column</th> |
10 <th>Second column</th> | 10 <th>Second column</th> |
(...skipping 24 matching lines...) Expand all Loading... |
35 }) | 35 }) |
36 }, 'deleteRow function invalid argument bis'); | 36 }, 'deleteRow function invalid argument bis'); |
37 | 37 |
38 test(function() { | 38 test(function() { |
39 var old_length = el.rows.length; | 39 var old_length = el.rows.length; |
40 el.insertRow(-1); | 40 el.insertRow(-1); |
41 el.deleteRow(-1); | 41 el.deleteRow(-1); |
42 assert_equals(old_length, el.rows.length); | 42 assert_equals(old_length, el.rows.length); |
43 }, "check normal deleteRow"); | 43 }, "check normal deleteRow"); |
44 test(function() { | 44 test(function() { |
45 while (el.rows.length > 1) { | 45 assert_equals(el.rows.length, 3); |
| 46 do { |
| 47 var old_length = el.rows.length; |
46 el.deleteRow(-1); | 48 el.deleteRow(-1); |
47 } | 49 assert_equals(el.rows.length, old_length - 1); |
48 assert_equals(1, el.rows.length); | 50 } while (el.rows.length); |
49 }, "check normal deleteRow bis"); | 51 }, "check normal deleteRow bis"); |
| 52 |
| 53 test(function() { |
| 54 assert_equals(el.rows.length, 0); |
| 55 el.deleteRow(-1); |
| 56 }, 'deleteRow(-1) with no rows'); |
| 57 |
| 58 test(function() { |
| 59 assert_equals(el.rows.length, 0); |
| 60 assert_throws("IndexSizeError", function() { |
| 61 el.deleteRow(0); |
| 62 }); |
| 63 }, 'deleteRow(0) with no rows'); |
50 </script> | 64 </script> |
OLD | NEW |