6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
import { ComponentFixture , TestBed , fakeAsync , flush } from '@angular/core/testing' ;
9
- import { Component , ViewChild , TrackByFunction , Type , EventEmitter } from '@angular/core' ;
9
+ import { Component , ViewChild , TrackByFunction , Type , EventEmitter , ViewChildren , QueryList } from '@angular/core' ;
10
10
11
11
import { CollectionViewer , DataSource } from '@angular/cdk/collections' ;
12
12
import { Directionality , Direction } from '@angular/cdk/bidi' ;
@@ -17,7 +17,7 @@ import {BaseTreeControl} from './control/base-tree-control';
17
17
import { TreeControl } from './control/tree-control' ;
18
18
import { FlatTreeControl } from './control/flat-tree-control' ;
19
19
import { NestedTreeControl } from './control/nested-tree-control' ;
20
- import { CdkTreeModule } from './index' ;
20
+ import { CdkTreeModule , CdkTreeNodePadding } from './index' ;
21
21
import { CdkTree , CdkTreeNode } from './tree' ;
22
22
import { getTreeControlFunctionsMissingError } from './tree-errors' ;
23
23
@@ -137,6 +137,18 @@ describe('CdkTree', () => {
137
137
[ `${ data [ 2 ] . pizzaTopping } - ${ data [ 2 ] . pizzaCheese } + ${ data [ 2 ] . pizzaBase } ` ] ) ;
138
138
} ) ;
139
139
140
+ it ( 'should be able to set zero as the indent level' , ( ) => {
141
+ component . paddingNodes . forEach ( node => node . level = 0 ) ;
142
+ fixture . detectChanges ( ) ;
143
+
144
+ const data = dataSource . data ;
145
+
146
+ expectFlatTreeToMatch ( treeElement , 0 , 'px' ,
147
+ [ `${ data [ 0 ] . pizzaTopping } - ${ data [ 0 ] . pizzaCheese } + ${ data [ 0 ] . pizzaBase } ` ] ,
148
+ [ `${ data [ 1 ] . pizzaTopping } - ${ data [ 1 ] . pizzaCheese } + ${ data [ 1 ] . pizzaBase } ` ] ,
149
+ [ `${ data [ 2 ] . pizzaTopping } - ${ data [ 2 ] . pizzaCheese } + ${ data [ 2 ] . pizzaBase } ` ] ) ;
150
+ } ) ;
151
+
140
152
it ( 'should reset the opposite direction padding if the direction changes' , ( ) => {
141
153
const node = getNodes ( treeElement ) [ 0 ] ;
142
154
@@ -1132,7 +1144,7 @@ class SimpleCdkTreeApp {
1132
1144
indent : number | string = 28 ;
1133
1145
1134
1146
@ViewChild ( CdkTree , { static : false } ) tree : CdkTree < TestData > ;
1135
-
1147
+ @ ViewChildren ( CdkTreeNodePadding ) paddingNodes : QueryList < CdkTreeNodePadding < TestData > > ;
1136
1148
}
1137
1149
1138
1150
@Component ( {
0 commit comments