@@ -14,6 +14,10 @@ function flattenedTreeAssertions () {
14
14
'use strict' ;
15
15
16
16
var virtualDOM = axe . utils . getFlattenedTree ( fixture . firstChild ) ;
17
+ assert . equal ( virtualDOM . length , 1 ) ; // host
18
+ assert . equal ( virtualDOM [ 0 ] . actualNode . nodeName , 'DIV' ) ;
19
+
20
+ virtualDOM = virtualDOM [ 0 ] . children ;
17
21
assert . equal ( virtualDOM . length , 3 ) ;
18
22
assert . equal ( virtualDOM [ 0 ] . actualNode . nodeName , 'STYLE' ) ;
19
23
@@ -44,19 +48,20 @@ function shadowIdAssertions () {
44
48
'use strict' ;
45
49
46
50
var virtualDOM = axe . utils . getFlattenedTree ( fixture ) ;
47
- assert . isUndefined ( virtualDOM [ 0 ] . shadowId ) ;
48
- assert . isDefined ( virtualDOM [ 0 ] . children [ 0 ] . shadowId ) ;
49
- assert . isDefined ( virtualDOM [ 0 ] . children [ 1 ] . shadowId ) ;
50
- assert . isDefined ( virtualDOM [ 0 ] . children [ 4 ] . shadowId ) ;
51
+ assert . isUndefined ( virtualDOM [ 0 ] . shadowId ) ; //fixture
52
+ assert . isUndefined ( virtualDOM [ 0 ] . children [ 0 ] . shadowId ) ; //host
53
+ assert . isDefined ( virtualDOM [ 0 ] . children [ 0 ] . children [ 0 ] . shadowId ) ;
54
+ assert . isDefined ( virtualDOM [ 0 ] . children [ 0 ] . children [ 1 ] . shadowId ) ;
55
+ assert . isDefined ( virtualDOM [ 0 ] . children [ 1 ] . children [ 0 ] . shadowId ) ;
51
56
// shadow IDs in the same shadowRoot must be the same
52
- assert . equal ( virtualDOM [ 0 ] . children [ 0 ] . shadowId ,
53
- virtualDOM [ 0 ] . children [ 1 ] . shadowId ) ;
57
+ assert . equal ( virtualDOM [ 0 ] . children [ 0 ] . children [ 0 ] . shadowId ,
58
+ virtualDOM [ 0 ] . children [ 0 ] . children [ 1 ] . shadowId ) ;
54
59
// should cascade
55
- assert . equal ( virtualDOM [ 0 ] . children [ 1 ] . shadowId ,
56
- virtualDOM [ 0 ] . children [ 1 ] . children [ 0 ] . shadowId ) ;
60
+ assert . equal ( virtualDOM [ 0 ] . children [ 0 ] . children [ 1 ] . shadowId ,
61
+ virtualDOM [ 0 ] . children [ 0 ] . children [ 1 ] . children [ 0 ] . shadowId ) ;
57
62
// shadow IDs in different shadowRoots must be different
58
- assert . notEqual ( virtualDOM [ 0 ] . children [ 0 ] . shadowId ,
59
- virtualDOM [ 0 ] . children [ 4 ] . shadowId ) ;
63
+ assert . notEqual ( virtualDOM [ 0 ] . children [ 0 ] . children [ 0 ] . shadowId ,
64
+ virtualDOM [ 0 ] . children [ 1 ] . children [ 0 ] . shadowId ) ;
60
65
61
66
}
62
67
@@ -143,10 +148,10 @@ if (document.body && typeof document.body.attachShadow === 'function') {
143
148
it ( 'getFlattenedTree\'s virtual DOM should give an ID to the shadow DOM' , shadowIdAssertions ) ;
144
149
it ( 'getFlattenedTree\'s virtual DOM should have the fallback content' , function ( ) {
145
150
var virtualDOM = axe . utils . getFlattenedTree ( fixture ) ;
146
- assert . isTrue ( virtualDOM [ 0 ] . children [ 7 ] . children [ 0 ] . children . length === 2 ) ;
147
- assert . isTrue ( virtualDOM [ 0 ] . children [ 7 ] . children [ 0 ] . children [ 0 ] . actualNode . nodeType === 3 ) ;
148
- assert . isTrue ( virtualDOM [ 0 ] . children [ 7 ] . children [ 0 ] . children [ 0 ] . actualNode . textContent === 'fallback content' ) ;
149
- assert . isTrue ( virtualDOM [ 0 ] . children [ 7 ] . children [ 0 ] . children [ 1 ] . actualNode . nodeName === 'LI' ) ;
151
+ assert . isTrue ( virtualDOM [ 0 ] . children [ 2 ] . children [ 1 ] . children [ 0 ] . children . length === 2 ) ;
152
+ assert . isTrue ( virtualDOM [ 0 ] . children [ 2 ] . children [ 1 ] . children [ 0 ] . children [ 0 ] . actualNode . nodeType === 3 ) ;
153
+ assert . isTrue ( virtualDOM [ 0 ] . children [ 2 ] . children [ 1 ] . children [ 0 ] . children [ 0 ] . actualNode . textContent === 'fallback content' ) ;
154
+ assert . isTrue ( virtualDOM [ 0 ] . children [ 2 ] . children [ 1 ] . children [ 0 ] . children [ 1 ] . actualNode . nodeName === 'LI' ) ;
150
155
} ) ;
151
156
} ) ;
152
157
describe ( 'flattened-tree shadow DOM v1: boxed slots' , function ( ) {
0 commit comments