@@ -58,12 +58,12 @@ describe('CdkTree', () => {
58
58
configureCdkTreeTestingModule ( [ SimpleCdkTreeApp ] ) ;
59
59
fixture = TestBed . createComponent ( SimpleCdkTreeApp ) ;
60
60
61
+ fixture . detectChanges ( ) ;
62
+
61
63
component = fixture . componentInstance ;
62
64
dataSource = component . dataSource as FakeDataSource ;
63
65
tree = component . tree ;
64
66
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
65
-
66
- fixture . detectChanges ( ) ;
67
67
} ) ;
68
68
69
69
it ( 'with a connected data source' , ( ) => {
@@ -141,12 +141,12 @@ describe('CdkTree', () => {
141
141
configureCdkTreeTestingModule ( [ CdkTreeAppWithToggle ] ) ;
142
142
fixture = TestBed . createComponent ( CdkTreeAppWithToggle ) ;
143
143
144
+ fixture . detectChanges ( ) ;
145
+
144
146
component = fixture . componentInstance ;
145
147
dataSource = component . dataSource as FakeDataSource ;
146
148
tree = component . tree ;
147
149
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
148
-
149
- fixture . detectChanges ( ) ;
150
150
} ) ;
151
151
152
152
it ( 'should expand/collapse the node' , ( ) => {
@@ -227,12 +227,12 @@ describe('CdkTree', () => {
227
227
configureCdkTreeTestingModule ( [ WhenNodeCdkTreeApp ] ) ;
228
228
fixture = TestBed . createComponent ( WhenNodeCdkTreeApp ) ;
229
229
230
+ fixture . detectChanges ( ) ;
231
+
230
232
component = fixture . componentInstance ;
231
233
dataSource = component . dataSource as FakeDataSource ;
232
234
tree = component . tree ;
233
235
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
234
-
235
- fixture . detectChanges ( ) ;
236
236
} ) ;
237
237
238
238
it ( 'with the right data' , ( ) => {
@@ -265,13 +265,13 @@ describe('CdkTree', () => {
265
265
beforeEach ( ( ) => {
266
266
configureCdkTreeTestingModule ( [ ArrayDataSourceCdkTreeApp ] ) ;
267
267
fixture = TestBed . createComponent ( ArrayDataSourceCdkTreeApp ) ;
268
+ fixture . detectChanges ( ) ;
269
+
268
270
269
271
component = fixture . componentInstance ;
270
272
dataSource = component . dataSource as FakeDataSource ;
271
273
tree = component . tree ;
272
274
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
273
-
274
- fixture . detectChanges ( ) ;
275
275
} ) ;
276
276
277
277
it ( 'with the right data' , ( ) => {
@@ -305,12 +305,12 @@ describe('CdkTree', () => {
305
305
configureCdkTreeTestingModule ( [ ObservableDataSourceCdkTreeApp ] ) ;
306
306
fixture = TestBed . createComponent ( ObservableDataSourceCdkTreeApp ) ;
307
307
308
+ fixture . detectChanges ( ) ;
309
+
308
310
component = fixture . componentInstance ;
309
311
dataSource = component . dataSource as FakeDataSource ;
310
312
tree = component . tree ;
311
313
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
312
-
313
- fixture . detectChanges ( ) ;
314
314
} ) ;
315
315
316
316
it ( 'with the right data' , ( ) => {
@@ -343,13 +343,14 @@ describe('CdkTree', () => {
343
343
function createTrackByTestComponent ( trackByStrategy : 'reference' | 'property' | 'index' ) {
344
344
configureCdkTreeTestingModule ( [ CdkTreeAppWithTrackBy ] ) ;
345
345
fixture = TestBed . createComponent ( CdkTreeAppWithTrackBy ) ;
346
+ fixture . detectChanges ( ) ;
347
+
346
348
component = fixture . componentInstance ;
347
349
component . trackByStrategy = trackByStrategy ;
348
350
dataSource = component . dataSource as FakeDataSource ;
349
351
tree = component . tree ;
350
352
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
351
353
352
- fixture . detectChanges ( ) ;
353
354
354
355
// Each node receives an attribute 'initialIndex' the element's original place
355
356
getNodes ( treeElement ) . forEach ( ( node : Element , index : number ) => {
@@ -436,13 +437,12 @@ describe('CdkTree', () => {
436
437
beforeEach ( ( ) => {
437
438
configureCdkTreeTestingModule ( [ NestedCdkTreeApp ] ) ;
438
439
fixture = TestBed . createComponent ( NestedCdkTreeApp ) ;
440
+ fixture . detectChanges ( ) ;
439
441
440
442
component = fixture . componentInstance ;
441
443
dataSource = component . dataSource as FakeDataSource ;
442
444
tree = component . tree ;
443
445
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
444
-
445
- fixture . detectChanges ( ) ;
446
446
} ) ;
447
447
448
448
it ( 'with a connected data source' , ( ) => {
@@ -524,13 +524,12 @@ describe('CdkTree', () => {
524
524
beforeEach ( ( ) => {
525
525
configureCdkTreeTestingModule ( [ StaticNestedCdkTreeApp ] ) ;
526
526
fixture = TestBed . createComponent ( StaticNestedCdkTreeApp ) ;
527
+ fixture . detectChanges ( ) ;
527
528
528
529
component = fixture . componentInstance ;
529
530
dataSource = component . dataSource as FakeDataSource ;
530
531
tree = component . tree ;
531
532
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
532
-
533
- fixture . detectChanges ( ) ;
534
533
} ) ;
535
534
536
535
it ( 'with the right data' , ( ) => {
@@ -551,13 +550,12 @@ describe('CdkTree', () => {
551
550
beforeEach ( ( ) => {
552
551
configureCdkTreeTestingModule ( [ WhenNodeNestedCdkTreeApp ] ) ;
553
552
fixture = TestBed . createComponent ( WhenNodeNestedCdkTreeApp ) ;
553
+ fixture . detectChanges ( ) ;
554
554
555
555
component = fixture . componentInstance ;
556
556
dataSource = component . dataSource as FakeDataSource ;
557
557
tree = component . tree ;
558
558
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
559
-
560
- fixture . detectChanges ( ) ;
561
559
} ) ;
562
560
563
561
it ( 'with the right data' , ( ) => {
@@ -590,13 +588,12 @@ describe('CdkTree', () => {
590
588
beforeEach ( ( ) => {
591
589
configureCdkTreeTestingModule ( [ NestedCdkTreeAppWithToggle ] ) ;
592
590
fixture = TestBed . createComponent ( NestedCdkTreeAppWithToggle ) ;
591
+ fixture . detectChanges ( ) ;
593
592
594
593
component = fixture . componentInstance ;
595
594
dataSource = component . dataSource as FakeDataSource ;
596
595
tree = component . tree ;
597
596
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
598
-
599
- fixture . detectChanges ( ) ;
600
597
} ) ;
601
598
602
599
it ( 'should expand/collapse the node multiple times' , ( ) => {
@@ -689,13 +686,12 @@ describe('CdkTree', () => {
689
686
beforeEach ( ( ) => {
690
687
configureCdkTreeTestingModule ( [ ArrayDataSourceNestedCdkTreeApp ] ) ;
691
688
fixture = TestBed . createComponent ( ArrayDataSourceNestedCdkTreeApp ) ;
689
+ fixture . detectChanges ( ) ;
692
690
693
691
component = fixture . componentInstance ;
694
692
dataSource = component . dataSource as FakeDataSource ;
695
693
tree = component . tree ;
696
694
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
697
-
698
- fixture . detectChanges ( ) ;
699
695
} ) ;
700
696
701
697
it ( 'with the right data' , ( ) => {
@@ -726,13 +722,12 @@ describe('CdkTree', () => {
726
722
beforeEach ( ( ) => {
727
723
configureCdkTreeTestingModule ( [ ObservableDataSourceNestedCdkTreeApp ] ) ;
728
724
fixture = TestBed . createComponent ( ObservableDataSourceNestedCdkTreeApp ) ;
725
+ fixture . detectChanges ( ) ;
729
726
730
727
component = fixture . componentInstance ;
731
728
dataSource = component . dataSource as FakeDataSource ;
732
729
tree = component . tree ;
733
730
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
734
-
735
- fixture . detectChanges ( ) ;
736
731
} ) ;
737
732
738
733
it ( 'with the right data' , ( ) => {
@@ -763,15 +758,15 @@ describe('CdkTree', () => {
763
758
function createTrackByTestComponent ( trackByStrategy : 'reference' | 'property' | 'index' ) {
764
759
configureCdkTreeTestingModule ( [ NestedCdkTreeAppWithTrackBy ] ) ;
765
760
fixture = TestBed . createComponent ( NestedCdkTreeAppWithTrackBy ) ;
761
+ fixture . detectChanges ( ) ;
762
+
766
763
component = fixture . componentInstance ;
767
764
component . trackByStrategy = trackByStrategy ;
768
765
dataSource = component . dataSource as FakeDataSource ;
769
766
770
767
tree = component . tree ;
771
768
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
772
769
773
- fixture . detectChanges ( ) ;
774
-
775
770
// Each node receives an attribute 'initialIndex' the element's original place
776
771
getNodes ( treeElement ) . forEach ( ( node : Element , index : number ) => {
777
772
node . setAttribute ( 'initialIndex' , index . toString ( ) ) ;
@@ -912,13 +907,12 @@ describe('CdkTree', () => {
912
907
beforeEach ( ( ) => {
913
908
configureCdkTreeTestingModule ( [ DepthNestedCdkTreeApp ] ) ;
914
909
fixture = TestBed . createComponent ( DepthNestedCdkTreeApp ) ;
910
+ fixture . detectChanges ( ) ;
915
911
916
912
component = fixture . componentInstance ;
917
913
dataSource = component . dataSource as FakeDataSource ;
918
914
tree = component . tree ;
919
915
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
920
-
921
- fixture . detectChanges ( ) ;
922
916
} ) ;
923
917
924
918
it ( 'should have correct depth for nested tree' , ( ) => {
0 commit comments