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("replaceChild", function() { | 6 describe("replaceChild", 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 assert.equal(child4.parentNode, parent); | 60 assert.equal(child4.parentNode, parent); |
61 assert.isNull(oldChild.parentNode); | 61 assert.isNull(oldChild.parentNode); |
62 assert.equal(childNodeCount(parent), 5); | 62 assert.equal(childNodeCount(parent), 5); |
63 assert.equal(childElementCount(parent), 3); | 63 assert.equal(childElementCount(parent), 3); |
64 assert.equal(parent.lastChild, lastChild); | 64 assert.equal(parent.lastChild, lastChild); |
65 }); | 65 }); |
66 | 66 |
67 it("should throw when inserting a tree scope", function() { | 67 it("should throw when inserting a tree scope", function() { |
68 var parent = document.createElement("div"); | 68 var parent = document.createElement("div"); |
69 var doc = new Document(); | 69 var doc = new Document(); |
70 var shadowRoot = document.createElement("span").createShadowRoot(); | 70 var shadowRoot = document.createElement("span").ensureShadowRoot(); |
71 assert.throws(function() { | 71 assert.throws(function() { |
72 parent.replaceChild(doc); | 72 parent.replaceChild(doc); |
73 }); | 73 }); |
74 assert.throws(function() { | 74 assert.throws(function() { |
75 parent.replaceChild(shadowRoot); | 75 parent.replaceChild(shadowRoot); |
76 }); | 76 }); |
77 assert.throws(function() { | 77 assert.throws(function() { |
78 doc.replaceChild(fragment); | 78 doc.replaceChild(fragment); |
79 }); | 79 }); |
80 }); | 80 }); |
81 | 81 |
82 it("should throw when appending to a text", function() { | 82 it("should throw when appending to a text", function() { |
83 var parent = new Text(); | 83 var parent = new Text(); |
84 assert.throws(function() { | 84 assert.throws(function() { |
85 parent.replaceChild(document.createElement("div"), null); | 85 parent.replaceChild(document.createElement("div"), null); |
86 }); | 86 }); |
87 }); | 87 }); |
88 }); | 88 }); |
89 </script> | 89 </script> |
90 </sky> | 90 </sky> |
OLD | NEW |