OLD | NEW |
1 <sky> | 1 <sky> |
2 <import src="../resources/chai.sky" /> | 2 <import src="../resources/chai.sky" /> |
3 <import src="../resources/mocha.sky" /> | 3 <import src="../resources/mocha.sky" /> |
4 <import src="../resources/dom-utils.sky" as="DomUtils" /> | 4 <import src="../resources/dom-utils.sky" as="DomUtils" /> |
5 <script> | 5 <script> |
6 describe("appendChild", function() { | 6 describe("appendChild", function() { |
7 var childElementCount = DomUtils.childElementCount; | 7 var childElementCount = DomUtils.childElementCount; |
8 var childNodeCount = DomUtils.childNodeCount; | 8 var childNodeCount = DomUtils.childNodeCount; |
9 | 9 |
10 it("should throw with invalid arguments", function() { | 10 it("should throw with invalid arguments", function() { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 assert.equal(child2.parentNode, parent); | 46 assert.equal(child2.parentNode, parent); |
47 assert.equal(child3.parentNode, parent); | 47 assert.equal(child3.parentNode, parent); |
48 assert.equal(child4.parentNode, parent); | 48 assert.equal(child4.parentNode, parent); |
49 assert.equal(childNodeCount(parent), 4); | 49 assert.equal(childNodeCount(parent), 4); |
50 assert.equal(childElementCount(parent), 2); | 50 assert.equal(childElementCount(parent), 2); |
51 }); | 51 }); |
52 | 52 |
53 it("should throw when inserting a tree scope", function() { | 53 it("should throw when inserting a tree scope", function() { |
54 var parent = document.createElement("div"); | 54 var parent = document.createElement("div"); |
55 var doc = new Document(); | 55 var doc = new Document(); |
56 var shadowRoot = document.createElement("span").createShadowRoot(); | 56 var shadowRoot = document.createElement("span").ensureShadowRoot(); |
57 assert.throws(function() { | 57 assert.throws(function() { |
58 parent.appendChild(doc); | 58 parent.appendChild(doc); |
59 }); | 59 }); |
60 assert.throws(function() { | 60 assert.throws(function() { |
61 parent.appendChild(shadowRoot); | 61 parent.appendChild(shadowRoot); |
62 }); | 62 }); |
63 assert.throws(function() { | 63 assert.throws(function() { |
64 doc.appendChild(fragment); | 64 doc.appendChild(fragment); |
65 }); | 65 }); |
66 }); | 66 }); |
67 | 67 |
68 it("should throw when appending to a text", function() { | 68 it("should throw when appending to a text", function() { |
69 var parent = new Text(); | 69 var parent = new Text(); |
70 assert.throws(function() { | 70 assert.throws(function() { |
71 parent.appendChild(document.createElement("div")); | 71 parent.appendChild(document.createElement("div")); |
72 }); | 72 }); |
73 }); | 73 }); |
74 }); | 74 }); |
75 </script> | 75 </script> |
76 </sky> | 76 </sky> |
OLD | NEW |