File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change
8000
@@ -120,6 +120,27 @@ describe('ViewNode', () => {
120
120
expect ( refNode . nextSibling ) . toBeFalsy ( )
121
121
} )
122
122
123
+ test ( 'insertBefore sets siblings of both siblings' , ( ) => {
124
+ let parentNode = new ViewNode ( )
125
+ let firstNode = new ViewNode ( )
126
+ let lastNode = new ViewNode ( )
127
+ let childNode = new ViewNode ( )
128
+ parentNode . childNodes = [ firstNode , lastNode ]
129
+ firstNode . parentNode = parentNode
130
+ lastNode . parentNode = parentNode
131
+
132
+ parentNode . insertBefore ( childNode , lastNode )
133
+
134
+ expect ( parentNode . childNodes . length ) . toBe ( 3 )
135
+ expect ( childNode . parentNode ) . toEqual ( parentNode )
136
+ expect ( firstNode . nextSibling ) . toEqual ( childNode )
137
+ expect ( lastNode . prevSibling ) . toEqual ( childNode )
138
+ expect ( childNode . prevSibling ) . toEqual ( firstNode )
139
+ expect ( childNode . nextSibling ) . toEqual ( lastNode )
140
+ expect ( firstNode . prevSibling ) . toBeFalsy ( )
141
+ expect ( lastNode . nextSibling ) . toBeFalsy ( )
142
+ } )
143
+
123
144
test ( 'appendChild throws if no childNode is given' , ( ) => {
124
145
let node = new ViewNode ( )
125
146
You can’t perform that action at this time.
0 commit comments