66 * found in the LICENSE file at https://angular.io/license
77 */
88import { 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' ;
1010
1111import { CollectionViewer , DataSource } from '@angular/cdk/collections' ;
1212import { Directionality , Direction } from '@angular/cdk/bidi' ;
@@ -17,7 +17,7 @@ import {BaseTreeControl} from './control/base-tree-control';
1717import { TreeControl } from './control/tree-control' ;
1818import { FlatTreeControl } from './control/flat-tree-control' ;
1919import { NestedTreeControl } from './control/nested-tree-control' ;
20- import { CdkTreeModule } from './index' ;
20+ import { CdkTreeModule , CdkTreeNodePadding } from './index' ;
2121import { CdkTree , CdkTreeNode } from './tree' ;
2222import { getTreeControlFunctionsMissingError } from './tree-errors' ;
2323
@@ -137,6 +137,18 @@ describe('CdkTree', () => {
137137 [ `${ data [ 2 ] . pizzaTopping } - ${ data [ 2 ] . pizzaCheese } + ${ data [ 2 ] . pizzaBase } ` ] ) ;
138138 } ) ;
139139
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+
140152 it ( 'should reset the opposite direction padding if the direction changes' , ( ) => {
141153 const node = getNodes ( treeElement ) [ 0 ] ;
142154
@@ -1132,7 +1144,7 @@ class SimpleCdkTreeApp {
11321144 indent : number | string = 28 ;
11331145
11341146 @ViewChild ( CdkTree , { static : false } ) tree : CdkTree < TestData > ;
1135-
1147+ @ ViewChildren ( CdkTreeNodePadding ) paddingNodes : QueryList < CdkTreeNodePadding < TestData > > ;
11361148}
11371149
11381150@Component ( {
0 commit comments