@@ -13,7 +13,7 @@ describe 'Rule', ->
1313 asString = (object ) ->
1414 container = document .createElement ' div'
1515 if object instanceof Array
16- container .insertBefore (node .cloneNode (true )) for node in object
16+ container .appendChild (node .cloneNode (true )) for node in object
1717 container .innerHTML
1818 else
1919 object .outerHTML
@@ -134,31 +134,31 @@ describe 'Rule', ->
134134
135135 it " should add content as the first child of selection" , ->
136136 c = makeNode (' <div>' )[0 ]
137- e = c .insertBefore makeNode (' <span>' )[0 ]
138- f = e .insertBefore makeNode (' <span>' )[0 ]
137+ e = c .appendChild makeNode (' <span>' )[0 ]
138+ f = e .appendChild makeNode (' <span>' )[0 ]
139139 r = Rule .add ' a' , [f], null , ' -'
140140 expect (asString r).to .be .eql asString makeNode (' a<span></span>' )
141141 expect (asString c).to .be .eql asString makeNode (' <div><span>a<span></span></span></div>' )
142142
143143 it " should add content as the last child of selection" , ->
144144 c = makeNode (' <div>' )[0 ]
145- e = c .insertBefore makeNode (' <span>' )[0 ]
146- f = e .insertBefore makeNode (' <span>' )[0 ]
145+ e = c .appendChild makeNode (' <span>' )[0 ]
146+ f = e .appendChild makeNode (' <span>' )[0 ]
147147 r = Rule .add ' a' , [f], null , ' +'
148148 expect (asString c).to .be .eql asString makeNode (' <div><span><span></span>a</span></div>' )
149149 expect (asString r).to .be .eql asString makeNode (' <span></span>a' )
150150
151151 it " should set content to replace selection" , ->
152152 c = makeNode (' <div>' )[0 ]
153- e = c .insertBefore makeNode (' <span>' )[0 ]
153+ e = c .appendChild makeNode (' <span>' )[0 ]
154154 r = Rule .add ' a' , [e], null , ' ='
155155 expect (asString c).to .be .eql asString makeNode (' <div>a</div>' )
156156 expect (asString r).to .be .eql ' a'
157157
158158 it " should set content as the only child of selection" , ->
159159 c = makeNode (' <div>' )[0 ]
160- e = c .insertBefore makeNode (' <span>' )[0 ]
161- f = e .insertBefore makeNode (' <span>' )[0 ]
160+ e = c .appendChild makeNode (' <span>' )[0 ]
161+ f = e .appendChild makeNode (' <span>' )[0 ]
162162 r = Rule .add ' a' , [e]
163163 expect (asString c).to .be .eql asString makeNode (' <div><span>a</span></div>' )
164164 expect (asString r).to .be .eql asString makeNode (' <span>a</span>' )
0 commit comments