Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(791)

Side by Side Diff: sky/tests/dom/appendChild.sky

Issue 934863002: ParentNode#appendChild(null) shouldn't crash (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: git cl format Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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>
OLDNEW
« sky/engine/tonic/dart_exception_factory.cc ('K') | « sky/engine/tonic/dart_wrappable.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698