@@ -58,12 +58,12 @@ describe('CdkTree', () => {
5858 configureCdkTreeTestingModule ( [ SimpleCdkTreeApp ] ) ;
5959 fixture = TestBed . createComponent ( SimpleCdkTreeApp ) ;
6060
61+ fixture . detectChanges ( ) ;
62+
6163 component = fixture . componentInstance ;
6264 dataSource = component . dataSource as FakeDataSource ;
6365 tree = component . tree ;
6466 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
65-
66- fixture . detectChanges ( ) ;
6767 } ) ;
6868
6969 it ( 'with a connected data source' , ( ) => {
@@ -141,12 +141,12 @@ describe('CdkTree', () => {
141141 configureCdkTreeTestingModule ( [ CdkTreeAppWithToggle ] ) ;
142142 fixture = TestBed . createComponent ( CdkTreeAppWithToggle ) ;
143143
144+ fixture . detectChanges ( ) ;
145+
144146 component = fixture . componentInstance ;
145147 dataSource = component . dataSource as FakeDataSource ;
146148 tree = component . tree ;
147149 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
148-
149- fixture . detectChanges ( ) ;
150150 } ) ;
151151
152152 it ( 'should expand/collapse the node' , ( ) => {
@@ -227,12 +227,12 @@ describe('CdkTree', () => {
227227 configureCdkTreeTestingModule ( [ WhenNodeCdkTreeApp ] ) ;
228228 fixture = TestBed . createComponent ( WhenNodeCdkTreeApp ) ;
229229
230+ fixture . detectChanges ( ) ;
231+
230232 component = fixture . componentInstance ;
231233 dataSource = component . dataSource as FakeDataSource ;
232234 tree = component . tree ;
233235 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
234-
235- fixture . detectChanges ( ) ;
236236 } ) ;
237237
238238 it ( 'with the right data' , ( ) => {
@@ -265,13 +265,13 @@ describe('CdkTree', () => {
265265 beforeEach ( ( ) => {
266266 configureCdkTreeTestingModule ( [ ArrayDataSourceCdkTreeApp ] ) ;
267267 fixture = TestBed . createComponent ( ArrayDataSourceCdkTreeApp ) ;
268+ fixture . detectChanges ( ) ;
269+
268270
269271 component = fixture . componentInstance ;
270272 dataSource = component . dataSource as FakeDataSource ;
271273 tree = component . tree ;
272274 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
273-
274- fixture . detectChanges ( ) ;
275275 } ) ;
276276
277277 it ( 'with the right data' , ( ) => {
@@ -305,12 +305,12 @@ describe('CdkTree', () => {
305305 configureCdkTreeTestingModule ( [ ObservableDataSourceCdkTreeApp ] ) ;
306306 fixture = TestBed . createComponent ( ObservableDataSourceCdkTreeApp ) ;
307307
308+ fixture . detectChanges ( ) ;
309+
308310 component = fixture . componentInstance ;
309311 dataSource = component . dataSource as FakeDataSource ;
310312 tree = component . tree ;
311313 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
312-
313- fixture . detectChanges ( ) ;
314314 } ) ;
315315
316316 it ( 'with the right data' , ( ) => {
@@ -343,13 +343,14 @@ describe('CdkTree', () => {
343343 function createTrackByTestComponent ( trackByStrategy : 'reference' | 'property' | 'index' ) {
344344 configureCdkTreeTestingModule ( [ CdkTreeAppWithTrackBy ] ) ;
345345 fixture = TestBed . createComponent ( CdkTreeAppWithTrackBy ) ;
346+ fixture . detectChanges ( ) ;
347+
346348 component = fixture . componentInstance ;
347349 component . trackByStrategy = trackByStrategy ;
348350 dataSource = component . dataSource as FakeDataSource ;
349351 tree = component . tree ;
350352 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
351353
352- fixture . detectChanges ( ) ;
353354
354355 // Each node receives an attribute 'initialIndex' the element's original place
355356 getNodes ( treeElement ) . forEach ( ( node : Element , index : number ) => {
@@ -436,13 +437,12 @@ describe('CdkTree', () => {
436437 beforeEach ( ( ) => {
437438 configureCdkTreeTestingModule ( [ NestedCdkTreeApp ] ) ;
438439 fixture = TestBed . createComponent ( NestedCdkTreeApp ) ;
440+ fixture . detectChanges ( ) ;
439441
440442 component = fixture . componentInstance ;
441443 dataSource = component . dataSource as FakeDataSource ;
442444 tree = component . tree ;
443445 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
444-
445- fixture . detectChanges ( ) ;
446446 } ) ;
447447
448448 it ( 'with a connected data source' , ( ) => {
@@ -524,13 +524,12 @@ describe('CdkTree', () => {
524524 beforeEach ( ( ) => {
525525 configureCdkTreeTestingModule ( [ StaticNestedCdkTreeApp ] ) ;
526526 fixture = TestBed . createComponent ( StaticNestedCdkTreeApp ) ;
527+ fixture . detectChanges ( ) ;
527528
528529 component = fixture . componentInstance ;
529530 dataSource = component . dataSource as FakeDataSource ;
530531 tree = component . tree ;
531532 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
532-
533- fixture . detectChanges ( ) ;
534533 } ) ;
535534
536535 it ( 'with the right data' , ( ) => {
@@ -551,13 +550,12 @@ describe('CdkTree', () => {
551550 beforeEach ( ( ) => {
552551 configureCdkTreeTestingModule ( [ WhenNodeNestedCdkTreeApp ] ) ;
553552 fixture = TestBed . createComponent ( WhenNodeNestedCdkTreeApp ) ;
553+ fixture . detectChanges ( ) ;
554554
555555 component = fixture . componentInstance ;
556556 dataSource = component . dataSource as FakeDataSource ;
557557 tree = component . tree ;
558558 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
559-
560- fixture . detectChanges ( ) ;
561559 } ) ;
562560
563561 it ( 'with the right data' , ( ) => {
@@ -590,13 +588,12 @@ describe('CdkTree', () => {
590588 beforeEach ( ( ) => {
591589 configureCdkTreeTestingModule ( [ NestedCdkTreeAppWithToggle ] ) ;
592590 fixture = TestBed . createComponent ( NestedCdkTreeAppWithToggle ) ;
591+ fixture . detectChanges ( ) ;
593592
594593 component = fixture . componentInstance ;
595594 dataSource = component . dataSource as FakeDataSource ;
596595 tree = component . tree ;
597596 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
598-
599- fixture . detectChanges ( ) ;
600597 } ) ;
601598
602599 it ( 'should expand/collapse the node multiple times' , ( ) => {
@@ -689,13 +686,12 @@ describe('CdkTree', () => {
689686 beforeEach ( ( ) => {
690687 configureCdkTreeTestingModule ( [ ArrayDataSourceNestedCdkTreeApp ] ) ;
691688 fixture = TestBed . createComponent ( ArrayDataSourceNestedCdkTreeApp ) ;
689+ fixture . detectChanges ( ) ;
692690
693691 component = fixture . componentInstance ;
694692 dataSource = component . dataSource as FakeDataSource ;
695693 tree = component . tree ;
696694 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
697-
698- fixture . detectChanges ( ) ;
699695 } ) ;
700696
701697 it ( 'with the right data' , ( ) => {
@@ -726,13 +722,12 @@ describe('CdkTree', () => {
726722 beforeEach ( ( ) => {
727723 configureCdkTreeTestingModule ( [ ObservableDataSourceNestedCdkTreeApp ] ) ;
728724 fixture = TestBed . createComponent ( ObservableDataSourceNestedCdkTreeApp ) ;
725+ fixture . detectChanges ( ) ;
729726
730727 component = fixture . componentInstance ;
731728 dataSource = component . dataSource as FakeDataSource ;
732729 tree = component . tree ;
733730 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
734-
735- fixture . detectChanges ( ) ;
736731 } ) ;
737732
738733 it ( 'with the right data' , ( ) => {
@@ -763,15 +758,15 @@ describe('CdkTree', () => {
763758 function createTrackByTestComponent ( trackByStrategy : 'reference' | 'property' | 'index' ) {
764759 configureCdkTreeTestingModule ( [ NestedCdkTreeAppWithTrackBy ] ) ;
765760 fixture = TestBed . createComponent ( NestedCdkTreeAppWithTrackBy ) ;
761+ fixture . detectChanges ( ) ;
762+
766763 component = fixture . componentInstance ;
767764 component . trackByStrategy = trackByStrategy ;
768765 dataSource = component . dataSource as FakeDataSource ;
769766
770767 tree = component . tree ;
771768 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
772769
773- fixture . detectChanges ( ) ;
774-
775770 // Each node receives an attribute 'initialIndex' the element's original place
776771 getNodes ( treeElement ) . forEach ( ( node : Element , index : number ) => {
777772 node . setAttribute ( 'initialIndex' , index . toString ( ) ) ;
@@ -912,13 +907,12 @@ describe('CdkTree', () => {
912907 beforeEach ( ( ) => {
913908 configureCdkTreeTestingModule ( [ DepthNestedCdkTreeApp ] ) ;
914909 fixture = TestBed . createComponent ( DepthNestedCdkTreeApp ) ;
910+ fixture . detectChanges ( ) ;
915911
916912 component = fixture . componentInstance ;
917913 dataSource = component . dataSource as FakeDataSource ;
918914 tree = component . tree ;
919915 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
920-
921- fixture . detectChanges ( ) ;
922916 } ) ;
923917
924918 it ( 'should have correct depth for nested tree' , ( ) => {
0 commit comments