@@ -18,6 +18,12 @@ class HelloRootCmp {
1818 }
1919}
2020
21+ @Component ( { selector : 'hello-app' } )
22+ @Template ( { inline : 'before: <content></content> after: done' } )
23+ class HelloRootCmpContent {
24+ constructor ( ) { }
25+ }
26+
2127@Component ( { selector : 'hello-app-2' } )
2228@Template ( { inline : '{{greeting}} world, again!' } )
2329class HelloRootCmp2 {
@@ -48,14 +54,17 @@ class HelloRootCmp4 {
4854}
4955
5056export function main ( ) {
51- var fakeDoc , el , el2 , testBindings ;
57+ var fakeDoc , el , el2 , testBindings , lightDom ;
5258
5359 beforeEach ( ( ) => {
5460 fakeDoc = DOM . createHtmlDocument ( ) ;
5561 el = DOM . createElement ( 'hello-app' , fakeDoc ) ;
5662 el2 = DOM . createElement ( 'hello-app-2' , fakeDoc ) ;
63+ lightDom = DOM . createElement ( 'light-dom-el' , fakeDoc ) ;
5764 DOM . appendChild ( fakeDoc . body , el ) ;
5865 DOM . appendChild ( fakeDoc . body , el2 ) ;
66+ DOM . appendChild ( el , lightDom ) ;
67+ DOM . setText ( lightDom , 'loading' ) ;
5968 testBindings = [ bind ( appDocumentToken ) . toValue ( fakeDoc ) ] ;
6069 } ) ;
6170
@@ -93,8 +102,7 @@ export function main() {
93102 it ( 'should display hello world' , ( done ) => {
94103 var injectorPromise = bootstrap ( HelloRootCmp , testBindings ) ;
95104 injectorPromise . then ( ( injector ) => {
96- expect ( injector . get ( appElementToken )
97- . shadowRoot . childNodes [ 0 ] . nodeValue ) . toEqual ( 'hello world!' ) ;
105+ expect ( injector . get ( appElementToken ) ) . toHaveText ( 'hello world!' ) ;
98106 done ( ) ;
99107 } ) ;
100108 } ) ;
@@ -103,10 +111,8 @@ export function main() {
103111 var injectorPromise1 = bootstrap ( HelloRootCmp , testBindings ) ;
104112 var injectorPromise2 = bootstrap ( HelloRootCmp2 , testBindings ) ;
105113 PromiseWrapper . all ( [ injectorPromise1 , injectorPromise2 ] ) . then ( ( injectors ) => {
106- expect ( injectors [ 0 ] . get ( appElementToken )
107- . shadowRoot . childNodes [ 0 ] . nodeValue ) . toEqual ( 'hello world!' ) ;
108- expect ( injectors [ 1 ] . get ( appElementToken )
109- . shadowRoot . childNodes [ 0 ] . nodeValue ) . toEqual ( 'hello world, again!' ) ;
114+ expect ( injectors [ 0 ] . get ( appElementToken ) ) . toHaveText ( 'hello world!' ) ;
115+ expect ( injectors [ 1 ] . get ( appElementToken ) ) . toHaveText ( 'hello world, again!' ) ;
110116 done ( ) ;
111117 } ) ;
112118 } ) ;
@@ -131,5 +137,13 @@ export function main() {
131137 done ( ) ;
132138 } ) ;
133139 } ) ;
140+
141+ it ( "should support shadow dom content tag" , ( done ) => {
142+ var injectorPromise = bootstrap ( HelloRootCmpContent , testBindings ) ;
143+ injectorPromise . then ( ( injector ) => {
144+ expect ( injector . get ( appElementToken ) ) . toHaveText ( 'before: loading after: done' ) ;
145+ done ( ) ;
146+ } ) ;
147+ } ) ;
134148 } ) ;
135149}
0 commit comments