| OLD | NEW |
| 1 <sky> | 1 <sky> |
| 2 <import src="../resources/dom-utils.sky" as="DomUtils" /> | 2 <import src="../resources/dom-utils.sky" as="DomUtils" /> |
| 3 <script> | 3 <script> |
| 4 import "../resources/third_party/unittest/unittest.dart"; | 4 import "../resources/third_party/unittest/unittest.dart"; |
| 5 import "../resources/unit.dart"; | 5 import "../resources/unit.dart"; |
| 6 | 6 |
| 7 import "dart:sky"; | 7 import "dart:sky"; |
| 8 | 8 |
| 9 void main() { | 9 void main() { |
| 10 initUnit(); | 10 initUnit(); |
| 11 | 11 |
| 12 var childElementCount = DomUtils.childElementCount; | 12 var childElementCount = DomUtils.childElementCount; |
| 13 var childNodeCount = DomUtils.childNodeCount; | 13 var childNodeCount = DomUtils.childNodeCount; |
| 14 | 14 |
| 15 test("should throw with invalid arguments", () { | 15 test("should throw with invalid arguments", () { |
| 16 var parent = document.createElement("div"); | 16 var parent = document.createElement("div"); |
| 17 expect(() { | 17 expect(() { |
| 18 parent.appendChild(); | 18 parent.appendChild(); |
| 19 }, throws); | 19 }, throws); |
| 20 // TODO(dart): This is a real bug. | 20 expect(() { |
| 21 // expect(() { | 21 parent.appendChild(null); |
| 22 // parent.appendChild(null); | 22 }, throws); |
| 23 // }, throws); | |
| 24 expect(() { | 23 expect(() { |
| 25 parent.appendChild({tagName: "div"}); | 24 parent.appendChild({tagName: "div"}); |
| 26 }, throws); | 25 }, throws); |
| 27 }); | 26 }); |
| 28 | 27 |
| 29 test("should insert children", () { | 28 test("should insert children", () { |
| 30 var parent = document.createElement("div"); | 29 var parent = document.createElement("div"); |
| 31 var child1 = parent.appendChild(document.createElement("div")); | 30 var child1 = parent.appendChild(document.createElement("div")); |
| 32 var child2 = parent.appendChild(new Text(" text ")); | 31 var child2 = parent.appendChild(new Text(" text ")); |
| 33 var child3 = parent.appendChild(new Text(" ")); | 32 var child3 = parent.appendChild(new Text(" ")); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // TODO(dart): These might be real bugs too. | 74 // TODO(dart): These might be real bugs too. |
| 76 // test("should throw when appending to a text", () { | 75 // test("should throw when appending to a text", () { |
| 77 // var parent = new Text(); | 76 // var parent = new Text(); |
| 78 // expect(() { | 77 // expect(() { |
| 79 // parent.appendChild(document.createElement("div")); | 78 // parent.appendChild(document.createElement("div")); |
| 80 // }, throws); | 79 // }, throws); |
| 81 // }); | 80 // }); |
| 82 } | 81 } |
| 83 </script> | 82 </script> |
| 84 </sky> | 83 </sky> |
| OLD | NEW |