@@ -15,20 +15,38 @@ describe('InitDirective', () => {
1515 host : Host
1616 } ) ;
1717
18- it ( 'should create variable through template' , ( ) => {
19- host = create ( `<ng-container *init="let variable of '${ VALUE_IN_TEMPLATE } '">{{ variable }}</ng-container>` ) ;
18+ describe ( 'using letOf' , ( ) => {
19+ it ( 'should create variable through template' , ( ) => {
20+ host = create ( `<ng-container *init="let variable of '${ VALUE_IN_TEMPLATE } '">{{ variable }}</ng-container>` ) ;
2021
21- expect ( host . hostElement ) . toHaveText ( VALUE_IN_TEMPLATE ) ;
22+ expect ( host . hostElement ) . toHaveText ( VALUE_IN_TEMPLATE ) ;
23+ } ) ;
24+
25+ it ( 'should create variable through binding' , ( ) => {
26+ host = create ( `<ng-container *init="let variable of example">{{ variable }}</ng-container>` ) ;
27+
28+ expect ( host . hostElement ) . not . toHaveText ( VALUE_THROUGH_BINDING ) ;
29+
30+ host . setHostInput ( { example : VALUE_THROUGH_BINDING } ) ;
31+ expect ( host . hostElement ) . toHaveText ( VALUE_THROUGH_BINDING ) ;
32+ } ) ;
2233 } ) ;
2334
24- it ( 'should create variable through binding' , ( ) => {
25- host = create ( `<ng-container *init="let variable of example">{{ variable }}</ng-container>` ) ;
35+ describe ( 'using as' , ( ) => {
36+ it ( 'should create variable through template' , ( ) => {
37+ host = create ( `<ng-container *init="'${ VALUE_IN_TEMPLATE } ' as variable">{{ variable }}</ng-container>` ) ;
38+
39+ expect ( host . hostElement ) . toHaveText ( VALUE_IN_TEMPLATE ) ;
40+ } ) ;
2641
27- expect ( host . hostElement ) . not . toHaveText ( VALUE_THROUGH_BINDING ) ;
42+ it ( 'should create variable through binding' , ( ) => {
43+ host = create ( `<ng-container *init="example as variable">{{ variable }}</ng-container>` ) ;
2844
29- host . setHostInput ( { example : VALUE_THROUGH_BINDING } ) ;
45+ expect ( host . hostElement ) . not . toHaveText ( VALUE_THROUGH_BINDING ) ;
3046
31- expect ( host . hostElement ) . toHaveText ( VALUE_THROUGH_BINDING ) ;
47+ host . setHostInput ( { example : VALUE_THROUGH_BINDING } ) ;
48+ expect ( host . hostElement ) . toHaveText ( VALUE_THROUGH_BINDING ) ;
49+ } ) ;
3250 } ) ;
3351
3452} ) ;
0 commit comments