@@ -64,12 +64,12 @@ describe('CdkTree', () => {
64
64
configureCdkTreeTestingModule ( [ SimpleCdkTreeApp ] ) ;
65
65
fixture = TestBed . createComponent ( SimpleCdkTreeApp ) ;
66
66
67
+ fixture . detectChanges ( ) ;
68
+
67
69
component = fixture . componentInstance ;
68
70
dataSource = component . dataSource as FakeDataSource ;
69
71
tree = component . tree ;
70
72
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
71
-
72
- fixture . detectChanges ( ) ;
73
73
} ) ;
74
74
75
75
it ( 'with a connected data source' , ( ) => {
@@ -164,12 +164,12 @@ describe('CdkTree', () => {
164
164
configureCdkTreeTestingModule ( [ CdkTreeAppWithToggle ] ) ;
165
165
fixture = TestBed . createComponent ( CdkTreeAppWithToggle ) ;
166
166
167
+ fixture . detectChanges ( ) ;
168
+
167
169
component = fixture . componentInstance ;
168
170
dataSource = component . dataSource as FakeDataSource ;
169
171
tree = component . tree ;
170
172
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
171
-
172
- fixture . detectChanges ( ) ;
173
173
} ) ;
174
174
175
175
it ( 'should expand/collapse the node' , ( ) => {
@@ -250,12 +250,12 @@ describe('CdkTree', () => {
250
250
configureCdkTreeTestingModule ( [ WhenNodeCdkTreeApp ] ) ;
251
251
fixture = TestBed . createComponent ( WhenNodeCdkTreeApp ) ;
252
252
253
+ fixture . detectChanges ( ) ;
254
+
253
255
component = fixture . componentInstance ;
254
256
dataSource = component . dataSource as FakeDataSource ;
255
257
tree = component . tree ;
256
258
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
257
-
258
- fixture . detectChanges ( ) ;
259
259
} ) ;
260
260
261
261
it ( 'with the right data' , ( ) => {
@@ -288,13 +288,13 @@ describe('CdkTree', () => {
288
288
beforeEach ( ( ) => {
289
289
configureCdkTreeTestingModule ( [ ArrayDataSourceCdkTreeApp ] ) ;
290
290
fixture = TestBed . createComponent ( ArrayDataSourceCdkTreeApp ) ;
291
+ fixture . detectChanges ( ) ;
292
+
291
293
292
294
component = fixture . componentInstance ;
293
295
dataSource = component . dataSource as FakeDataSource ;
294
296
tree = component . tree ;
295
297
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
296
-
297
- fixture . detectChanges ( ) ;
298
298
} ) ;
299
299
300
300
it ( 'with the right data' , ( ) => {
@@ -328,12 +328,12 @@ describe('CdkTree', () => {
328
328
configureCdkTreeTestingModule ( [ ObservableDataSourceCdkTreeApp ] ) ;
329
329
fixture = TestBed . createComponent ( ObservableDataSourceCdkTreeApp ) ;
330
330
331
+ fixture . detectChanges ( ) ;
332
+
331
333
component = fixture . componentInstance ;
332
334
dataSource = component . dataSource as FakeDataSource ;
333
335
tree = component . tree ;
334
336
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
335
-
336
- fixture . detectChanges ( ) ;
337
337
} ) ;
338
338
339
339
it ( 'with the right data' , ( ) => {
@@ -368,18 +368,18 @@ describe('CdkTree', () => {
368
368
fixture = TestBed . createComponent ( CdkTreeAppWithTrackBy ) ;
369
369
component = fixture . componentInstance ;
370
370
component . trackByStrategy = trackByStrategy ;
371
+ fixture . detectChanges ( ) ;
372
+
371
373
dataSource = component . dataSource as FakeDataSource ;
372
374
tree = component . tree ;
373
375
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
374
376
375
- fixture . detectChanges ( ) ;
376
-
377
377
// Each node receives an attribute 'initialIndex' the element's original place
378
378
getNodes ( treeElement ) . forEach ( ( node : Element , index : number ) => {
379
379
node . setAttribute ( 'initialIndex' , index . toString ( ) ) ;
380
380
} ) ;
381
381
382
- // Prove that the attributes match their indicies
382
+ // Prove that the attributes match their indices
383
383
const initialNodes = getNodes ( treeElement ) ;
384
384
expect ( initialNodes [ 0 ] . getAttribute ( 'initialIndex' ) ) . toBe ( '0' ) ;
385
385
expect ( initialNodes [ 1 ] . getAttribute ( 'initialIndex' ) ) . toBe ( '1' ) ;
@@ -459,13 +459,12 @@ describe('CdkTree', () => {
459
459
beforeEach ( ( ) => {
460
460
configureCdkTreeTestingModule ( [ NestedCdkTreeApp ] ) ;
461
461
fixture = TestBed . createComponent ( NestedCdkTreeApp ) ;
462
+ fixture . detectChanges ( ) ;
462
463
463
464
component = fixture . componentInstance ;
464
465
dataSource = component . dataSource as FakeDataSource ;
465
466
tree = component . tree ;
466
467
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
467
-
468
- fixture . detectChanges ( ) ;
469
468
} ) ;
470
469
471
470
it ( 'with a connected data source' , ( ) => {
@@ -547,13 +546,12 @@ describe('CdkTree', () => {
547
546
beforeEach ( ( ) => {
548
547
configureCdkTreeTestingModule ( [ StaticNestedCdkTreeApp ] ) ;
549
548
fixture = TestBed . createComponent ( StaticNestedCdkTreeApp ) ;
549
+ fixture . detectChanges ( ) ;
550
550
551
551
component = fixture . componentInstance ;
552
552
dataSource = component . dataSource as FakeDataSource ;
553
553
tree = component . tree ;
554
554
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
555
-
556
- fixture . detectChanges ( ) ;
557
555
} ) ;
558
556
559
557
it ( 'with the right data' , ( ) => {
@@ -574,13 +572,12 @@ describe('CdkTree', () => {
574
572
beforeEach ( ( ) => {
575
573
configureCdkTreeTestingModule ( [ WhenNodeNestedCdkTreeApp ] ) ;
576
574
fixture = TestBed . createComponent ( WhenNodeNestedCdkTreeApp ) ;
575
+ fixture . detectChanges ( ) ;
577
576
578
577
component = fixture . componentInstance ;
579
578
dataSource = component . dataSource as FakeDataSource ;
580
579
tree = component . tree ;
581
580
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
582
-
583
- fixture . detectChanges ( ) ;
584
581
} ) ;
585
582
586
583
it ( 'with the right data' , ( ) => {
@@ -613,13 +610,12 @@ describe('CdkTree', () => {
613
610
beforeEach ( ( ) => {
614
611
configureCdkTreeTestingModule ( [ NestedCdkTreeAppWithToggle ] ) ;
615
612
fixture = TestBed . createComponent ( NestedCdkTreeAppWithToggle ) ;
613
+ fixture . detectChanges ( ) ;
616
614
617
615
component = fixture . componentInstance ;
618
616
dataSource = component . dataSource as FakeDataSource ;
619
617
tree = component . tree ;
620
618
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
621
-
622
- fixture . detectChanges ( ) ;
623
619
} ) ;
624
620
625
621
it ( 'should expand/collapse the node multiple times' , ( ) => {
@@ -712,13 +708,12 @@ describe('CdkTree', () => {
712
708
beforeEach ( ( ) => {
713
709
configureCdkTreeTestingModule ( [ ArrayDataSourceNestedCdkTreeApp ] ) ;
714
710
fixture = TestBed . createComponent ( ArrayDataSourceNestedCdkTreeApp ) ;
711
+ fixture . detectChanges ( ) ;
715
712
716
713
component = fixture . componentInstance ;
717
714
dataSource = component . dataSource as FakeDataSource ;
718
715
tree = component . tree ;
719
716
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
720
-
721
- fixture . detectChanges ( ) ;
722
717
} ) ;
723
718
724
719
it ( 'with the right data' , ( ) => {
@@ -749,13 +744,12 @@ describe('CdkTree', () => {
749
744
beforeEach ( ( ) => {
750
745
configureCdkTreeTestingModule ( [ ObservableDataSourceNestedCdkTreeApp ] ) ;
751
746
fixture = TestBed . createComponent ( ObservableDataSourceNestedCdkTreeApp ) ;
747
+ fixture . detectChanges ( ) ;
752
748
753
749
component = fixture . componentInstance ;
754
750
dataSource = component . dataSource as FakeDataSource ;
755
751
tree = component . tree ;
756
752
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
757
-
758
- fixture . detectChanges ( ) ;
759
753
} ) ;
760
754
761
755
it ( 'with the right data' , ( ) => {
@@ -789,12 +783,11 @@ describe('CdkTree', () => {
789
783
component = fixture . componentInstance ;
790
784
component . trackByStrategy = trackByStrategy ;
791
785
dataSource = component . dataSource as FakeDataSource ;
786
+ fixture . detectChanges ( ) ;
792
787
793
788
tree = component . tree ;
794
789
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
795
790
796
- fixture . detectChanges ( ) ;
797
-
798
791
// Each node receives an attribute 'initialIndex' the element's original place
799
792
getNodes ( treeElement ) . forEach ( ( node : Element , index : number ) => {
800
793
node . setAttribute ( 'initialIndex' , index . toString ( ) ) ;
@@ -935,13 +928,12 @@ describe('CdkTree', () => {
935
928
beforeEach ( ( ) => {
936
929
configureCdkTreeTestingModule ( [ DepthNestedCdkTreeApp ] ) ;
937
930
fixture = TestBed . createComponent ( DepthNestedCdkTreeApp ) ;
931
+ fixture . detectChanges ( ) ;
938
932
939
933
component = fixture . componentInstance ;
940
934
dataSource = component . dataSource as FakeDataSource ;
941
935
tree = component . tree ;
942
936
treeElement = fixture . nativeElement . querySelector ( 'cdk-tree' ) ;
943
-
944
- fixture . detectChanges ( ) ;
945
937
} ) ;
946
938
947
939
it ( 'should have correct depth for nested tree' , ( ) => {
0 commit comments