@@ -64,12 +64,12 @@ describe('CdkTree', () => {
6464 configureCdkTreeTestingModule ( [ SimpleCdkTreeApp ] ) ;
6565 fixture = TestBed . createComponent ( SimpleCdkTreeApp ) ;
6666
67+ fixture . detectChanges ( ) ;
68+
6769 component = fixture . componentInstance ;
6870 dataSource = component . dataSource as FakeDataSource ;
6971 tree = component . tree ;
7072 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
71-
72- fixture . detectChanges ( ) ;
7373 } ) ;
7474
7575 it ( 'with a connected data source' , ( ) => {
@@ -164,12 +164,12 @@ describe('CdkTree', () => {
164164 configureCdkTreeTestingModule ( [ CdkTreeAppWithToggle ] ) ;
165165 fixture = TestBed . createComponent ( CdkTreeAppWithToggle ) ;
166166
167+ fixture . detectChanges ( ) ;
168+
167169 component = fixture . componentInstance ;
168170 dataSource = component . dataSource as FakeDataSource ;
169171 tree = component . tree ;
170172 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
171-
172- fixture . detectChanges ( ) ;
173173 } ) ;
174174
175175 it ( 'should expand/collapse the node' , ( ) => {
@@ -250,12 +250,12 @@ describe('CdkTree', () => {
250250 configureCdkTreeTestingModule ( [ WhenNodeCdkTreeApp ] ) ;
251251 fixture = TestBed . createComponent ( WhenNodeCdkTreeApp ) ;
252252
253+ fixture . detectChanges ( ) ;
254+
253255 component = fixture . componentInstance ;
254256 dataSource = component . dataSource as FakeDataSource ;
255257 tree = component . tree ;
256258 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
257-
258- fixture . detectChanges ( ) ;
259259 } ) ;
260260
261261 it ( 'with the right data' , ( ) => {
@@ -288,13 +288,13 @@ describe('CdkTree', () => {
288288 beforeEach ( ( ) => {
289289 configureCdkTreeTestingModule ( [ ArrayDataSourceCdkTreeApp ] ) ;
290290 fixture = TestBed . createComponent ( ArrayDataSourceCdkTreeApp ) ;
291+ fixture . detectChanges ( ) ;
292+
291293
292294 component = fixture . componentInstance ;
293295 dataSource = component . dataSource as FakeDataSource ;
294296 tree = component . tree ;
295297 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
296-
297- fixture . detectChanges ( ) ;
298298 } ) ;
299299
300300 it ( 'with the right data' , ( ) => {
@@ -328,12 +328,12 @@ describe('CdkTree', () => {
328328 configureCdkTreeTestingModule ( [ ObservableDataSourceCdkTreeApp ] ) ;
329329 fixture = TestBed . createComponent ( ObservableDataSourceCdkTreeApp ) ;
330330
331+ fixture . detectChanges ( ) ;
332+
331333 component = fixture . componentInstance ;
332334 dataSource = component . dataSource as FakeDataSource ;
333335 tree = component . tree ;
334336 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
335-
336- fixture . detectChanges ( ) ;
337337 } ) ;
338338
339339 it ( 'with the right data' , ( ) => {
@@ -368,18 +368,18 @@ describe('CdkTree', () => {
368368 fixture = TestBed . createComponent ( CdkTreeAppWithTrackBy ) ;
369369 component = fixture . componentInstance ;
370370 component . trackByStrategy = trackByStrategy ;
371+ fixture . detectChanges ( ) ;
372+
371373 dataSource = component . dataSource as FakeDataSource ;
372374 tree = component . tree ;
373375 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
374376
375- fixture . detectChanges ( ) ;
376-
377377 // Each node receives an attribute 'initialIndex' the element's original place
378378 getNodes ( treeElement ) . forEach ( ( node : Element , index : number ) => {
379379 node . setAttribute ( 'initialIndex' , index . toString ( ) ) ;
380380 } ) ;
381381
382- // Prove that the attributes match their indicies
382+ // Prove that the attributes match their indices
383383 const initialNodes = getNodes ( treeElement ) ;
384384 expect ( initialNodes [ 0 ] . getAttribute ( 'initialIndex' ) ) . toBe ( '0' ) ;
385385 expect ( initialNodes [ 1 ] . getAttribute ( 'initialIndex' ) ) . toBe ( '1' ) ;
@@ -459,13 +459,12 @@ describe('CdkTree', () => {
459459 beforeEach ( ( ) => {
460460 configureCdkTreeTestingModule ( [ NestedCdkTreeApp ] ) ;
461461 fixture = TestBed . createComponent ( NestedCdkTreeApp ) ;
462+ fixture . detectChanges ( ) ;
462463
463464 component = fixture . componentInstance ;
464465 dataSource = component . dataSource as FakeDataSource ;
465466 tree = component . tree ;
466467 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
467-
468- fixture . detectChanges ( ) ;
469468 } ) ;
470469
471470 it ( 'with a connected data source' , ( ) => {
@@ -547,13 +546,12 @@ describe('CdkTree', () => {
547546 beforeEach ( ( ) => {
548547 configureCdkTreeTestingModule ( [ StaticNestedCdkTreeApp ] ) ;
549548 fixture = TestBed . createComponent ( StaticNestedCdkTreeApp ) ;
549+ fixture . detectChanges ( ) ;
550550
551551 component = fixture . componentInstance ;
552552 dataSource = component . dataSource as FakeDataSource ;
553553 tree = component . tree ;
554554 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
555-
556- fixture . detectChanges ( ) ;
557555 } ) ;
558556
559557 it ( 'with the right data' , ( ) => {
@@ -574,13 +572,12 @@ describe('CdkTree', () => {
574572 beforeEach ( ( ) => {
575573 configureCdkTreeTestingModule ( [ WhenNodeNestedCdkTreeApp ] ) ;
576574 fixture = TestBed . createComponent ( WhenNodeNestedCdkTreeApp ) ;
575+ fixture . detectChanges ( ) ;
577576
578577 component = fixture . componentInstance ;
579578 dataSource = component . dataSource as FakeDataSource ;
580579 tree = component . tree ;
581580 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
582-
583- fixture . detectChanges ( ) ;
584581 } ) ;
585582
586583 it ( 'with the right data' , ( ) => {
@@ -613,13 +610,12 @@ describe('CdkTree', () => {
613610 beforeEach ( ( ) => {
614611 configureCdkTreeTestingModule ( [ NestedCdkTreeAppWithToggle ] ) ;
615612 fixture = TestBed . createComponent ( NestedCdkTreeAppWithToggle ) ;
613+ fixture . detectChanges ( ) ;
616614
617615 component = fixture . componentInstance ;
618616 dataSource = component . dataSource as FakeDataSource ;
619617 tree = component . tree ;
620618 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
621-
622- fixture . detectChanges ( ) ;
623619 } ) ;
624620
625621 it ( 'should expand/collapse the node multiple times' , ( ) => {
@@ -712,13 +708,12 @@ describe('CdkTree', () => {
712708 beforeEach ( ( ) => {
713709 configureCdkTreeTestingModule ( [ ArrayDataSourceNestedCdkTreeApp ] ) ;
714710 fixture = TestBed . createComponent ( ArrayDataSourceNestedCdkTreeApp ) ;
711+ fixture . detectChanges ( ) ;
715712
716713 component = fixture . componentInstance ;
717714 dataSource = component . dataSource as FakeDataSource ;
718715 tree = component . tree ;
719716 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
720-
721- fixture . detectChanges ( ) ;
722717 } ) ;
723718
724719 it ( 'with the right data' , ( ) => {
@@ -749,13 +744,12 @@ describe('CdkTree', () => {
749744 beforeEach ( ( ) => {
750745 configureCdkTreeTestingModule ( [ ObservableDataSourceNestedCdkTreeApp ] ) ;
751746 fixture = TestBed . createComponent ( ObservableDataSourceNestedCdkTreeApp ) ;
747+ fixture . detectChanges ( ) ;
752748
753749 component = fixture . componentInstance ;
754750 dataSource = component . dataSource as FakeDataSource ;
755751 tree = component . tree ;
756752 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
757-
758- fixture . detectChanges ( ) ;
759753 } ) ;
760754
761755 it ( 'with the right data' , ( ) => {
@@ -789,12 +783,11 @@ describe('CdkTree', () => {
789783 component = fixture . componentInstance ;
790784 component . trackByStrategy = trackByStrategy ;
791785 dataSource = component . dataSource as FakeDataSource ;
786+ fixture . detectChanges ( ) ;
792787
793788 tree = component . tree ;
794789 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
795790
796- fixture . detectChanges ( ) ;
797-
798791 // Each node receives an attribute 'initialIndex' the element's original place
799792 getNodes ( treeElement ) . forEach ( ( node : Element , index : number ) => {
800793 node . setAttribute ( 'initialIndex' , index . toString ( ) ) ;
@@ -935,13 +928,12 @@ describe('CdkTree', () => {
935928 beforeEach ( ( ) => {
936929 configureCdkTreeTestingModule ( [ DepthNestedCdkTreeApp ] ) ;
937930 fixture = TestBed . createComponent ( DepthNestedCdkTreeApp ) ;
931+ fixture . detectChanges ( ) ;
938932
939933 component = fixture . componentInstance ;
940934 dataSource = component . dataSource as FakeDataSource ;
941935 tree = component . tree ;
942936 treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
943-
944- fixture . detectChanges ( ) ;
945937 } ) ;
946938
947939 it ( 'should have correct depth for nested tree' , ( ) => {
0 commit comments