Skip to content

Commit c76fb63

Browse files
committed
test(TreeGrid): #5005 Made BeforeEach async
1 parent 1a12da3 commit c76fb63

11 files changed

+32
-67
lines changed

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-crud.spec.ts

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,12 @@ describe('IgxTreeGrid - CRUD', () => {
3434
describe('Child Collection', () => {
3535
// configureTestSuite();
3636

37-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
37+
beforeEach(async(/** height/width setter rAF */() => {
3838
fix = TestBed.createComponent(IgxTreeGridSimpleComponent);
3939
fix.detectChanges();
40-
tick(16);
4140
treeGrid = fix.componentInstance.treeGrid;
4241
treeGrid.height = '800px';
4342
fix.detectChanges();
44-
tick(16);
4543
}));
4644

4745
it('should support adding root row through treeGrid API', () => {
@@ -196,13 +194,12 @@ describe('IgxTreeGrid - CRUD', () => {
196194

197195
describe('Primary/Foreign key', () => {
198196
// configureTestSuite();
199-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
197+
beforeEach(async(/** height/width setter rAF */() => {
200198
fix = TestBed.createComponent(IgxTreeGridPrimaryForeignKeyComponent);
201199
fix.detectChanges();
202200
treeGrid = fix.componentInstance.treeGrid;
203201
treeGrid.height = '800px';
204202
fix.detectChanges();
205-
tick(16);
206203
}));
207204

208205
it('should support adding root row through treeGrid API', () => {
@@ -302,10 +299,9 @@ describe('IgxTreeGrid - CRUD', () => {
302299
describe('Update API', () => {
303300
describe('Child Collection', () => {
304301
// configureTestSuite();
305-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
302+
beforeEach(async(/** height/width setter rAF */() => {
306303
fix = TestBed.createComponent(IgxTreeGridSimpleComponent);
307304
fix.detectChanges();
308-
tick(16);
309305
treeGrid = fix.componentInstance.treeGrid;
310306
}));
311307

@@ -457,10 +453,9 @@ describe('IgxTreeGrid - CRUD', () => {
457453

458454
describe('Primary/Foreign key', () => {
459455
// configureTestSuite();
460-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
456+
beforeEach(async(/** height/width setter rAF */() => {
461457
fix = TestBed.createComponent(IgxTreeGridPrimaryForeignKeyComponent);
462458
fix.detectChanges();
463-
tick(16);
464459
treeGrid = fix.componentInstance.treeGrid;
465460
}));
466461

@@ -684,10 +679,9 @@ describe('IgxTreeGrid - CRUD', () => {
684679
describe('Update UI', () => {
685680
describe('Child Collection', () => {
686681
// configureTestSuite();
687-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
682+
beforeEach(async(/** height/width setter rAF */() => {
688683
fix = TestBed.createComponent(IgxTreeGridSimpleComponent);
689684
fix.detectChanges();
690-
tick(16);
691685
treeGrid = fix.componentInstance.treeGrid;
692686
for (const col of treeGrid.columns) {
693687
col.editable = true;
@@ -854,10 +848,9 @@ describe('IgxTreeGrid - CRUD', () => {
854848

855849
describe('Primary/Foreign key', () => {
856850
// configureTestSuite();
857-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
851+
beforeEach(async(/** height/width setter rAF */() => {
858852
fix = TestBed.createComponent(IgxTreeGridPrimaryForeignKeyComponent);
859853
fix.detectChanges();
860-
tick(16);
861854
treeGrid = fix.componentInstance.treeGrid;
862855
for (const col of treeGrid.columns) {
863856
col.editable = true;
@@ -1024,10 +1017,9 @@ describe('IgxTreeGrid - CRUD', () => {
10241017
describe('Delete', () => {
10251018
describe('Child Collection', () => {
10261019
// configureTestSuite();
1027-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
1020+
beforeEach(async(/** height/width setter rAF */() => {
10281021
fix = TestBed.createComponent(IgxTreeGridSimpleComponent);
10291022
fix.detectChanges();
1030-
tick(16);
10311023
treeGrid = fix.componentInstance.treeGrid;
10321024
}));
10331025

@@ -1126,10 +1118,9 @@ describe('IgxTreeGrid - CRUD', () => {
11261118

11271119
describe('Primary/Foreign key', () => {
11281120
// configureTestSuite();
1129-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
1121+
beforeEach(async(/** height/width setter rAF */() => {
11301122
fix = TestBed.createComponent(IgxTreeGridPrimaryForeignKeyComponent);
11311123
fix.detectChanges();
1132-
tick(16);
11331124
treeGrid = fix.componentInstance.treeGrid;
11341125
treeGrid.cascadeOnDelete = false;
11351126
}));

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-expanding.spec.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ describe('IgxTreeGrid - Expanding / Collapsing', () => {
3636
}));
3737

3838
describe('Child Collection', () => {
39-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
39+
beforeEach(async(/** height/width setter rAF */() => {
4040
fix = TestBed.createComponent(IgxTreeGridExpandingComponent);
4141
fix.detectChanges();
42-
tick(16);
4342
treeGrid = fix.componentInstance.treeGrid;
4443
}));
4544

@@ -440,10 +439,9 @@ describe('IgxTreeGrid - Expanding / Collapsing', () => {
440439
});
441440

442441
describe('Primary/Foreign key', () => {
443-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
442+
beforeEach(async(/** height/width setter rAF */() => {
444443
fix = TestBed.createComponent(IgxTreeGridPrimaryForeignKeyComponent);
445444
fix.detectChanges();
446-
tick(16);
447445
treeGrid = fix.componentInstance.treeGrid;
448446
treeGrid.expansionDepth = 0;
449447
fix.detectChanges();
@@ -835,10 +833,9 @@ describe('IgxTreeGrid - Expanding / Collapsing', () => {
835833
describe('Load On Demand', () => {
836834

837835
describe('Primary/Foreign key', () => {
838-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
836+
beforeEach(async(/** height/width setter rAF */() => {
839837
fix = TestBed.createComponent(IgxTreeGridLoadOnDemandComponent);
840838
fix.detectChanges();
841-
tick(16);
842839
treeGrid = fix.componentInstance.treeGrid;
843840
}));
844841

@@ -892,10 +889,9 @@ describe('IgxTreeGrid - Expanding / Collapsing', () => {
892889
});
893890

894891
describe('ChildDataKey', () => {
895-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
892+
beforeEach(async(/** height/width setter rAF */() => {
896893
fix = TestBed.createComponent(IgxTreeGridLoadOnDemandChildDataComponent);
897894
fix.detectChanges();
898-
tick(16);
899895
treeGrid = fix.componentInstance.treeGrid;
900896
}));
901897

@@ -949,10 +945,9 @@ describe('IgxTreeGrid - Expanding / Collapsing', () => {
949945
});
950946

951947
describe('HasChildrenKey', () => {
952-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
948+
beforeEach(async(/** height/width setter rAF */() => {
953949
fix = TestBed.createComponent(IgxTreeGridLoadOnDemandHasChildrenComponent);
954950
fix.detectChanges();
955-
tick(16);
956951
treeGrid = fix.componentInstance.treeGrid;
957952
}));
958953

@@ -1007,10 +1002,9 @@ describe('Row editing expanding/collapsing', () => {
10071002
.compileComponents();
10081003
}));
10091004

1010-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
1005+
beforeEach(async(/** height/width setter rAF */() => {
10111006
fix = TestBed.createComponent(IgxTreeGridRowEditingComponent);
10121007
fix.detectChanges();
1013-
tick(16);
10141008
treeGrid = fix.componentInstance.treeGrid;
10151009
}));
10161010

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-filtering.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ describe('IgxTreeGrid - Filtering actions', () => {
2424
.compileComponents();
2525
}));
2626

27-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
27+
beforeEach(async(/** height/width setter rAF */() => {
2828
fix = TestBed.createComponent(IgxTreeGridFilteringComponent);
2929
fix.detectChanges();
30-
tick(16);
3130
grid = fix.componentInstance.treeGrid;
3231
}));
3332

@@ -276,10 +275,9 @@ describe('IgxTreeGrid - Filtering actions', () => {
276275

277276
describe('Filtering: Row editing', () => {
278277
let treeGrid: IgxTreeGridComponent;
279-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
278+
beforeEach(async(/** height/width setter rAF */() => {
280279
fix = TestBed.createComponent(IgxTreeGridFilteringRowEditingComponent);
281280
fix.detectChanges();
282-
tick(16);
283281
treeGrid = fix.componentInstance.treeGrid;
284282
}));
285283

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-indentation.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,9 @@ describe('IgxTreeGrid - Indentation', () => {
3131

3232
describe('Child Collection', () => {
3333
// configureTestSuite();
34-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
34+
beforeEach(async(/** height/width setter rAF */() => {
3535
fix = TestBed.createComponent(IgxTreeGridSimpleComponent);
3636
fix.detectChanges();
37-
tick(16);
3837
treeGrid = fix.componentInstance.treeGrid;
3938
}));
4039

@@ -189,10 +188,9 @@ describe('IgxTreeGrid - Indentation', () => {
189188

190189
describe('Primary/Foreign key', () => {
191190
// configureTestSuite();
192-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
191+
beforeEach(async(/** height/width setter rAF */() => {
193192
fix = TestBed.createComponent(IgxTreeGridPrimaryForeignKeyComponent);
194193
fix.detectChanges();
195-
tick(16);
196194
treeGrid = fix.componentInstance.treeGrid;
197195
}));
198196

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-integration.spec.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,9 @@ describe('IgxTreeGrid - Integration', () => {
8383

8484
describe('Child Collection', () => {
8585
// configureTestSuite();
86-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
86+
beforeEach(async(/** height/width setter rAF */() => {
8787
fix = TestBed.createComponent(IgxTreeGridSimpleComponent);
8888
fix.detectChanges();
89-
tick(16);
9089
treeGrid = fix.componentInstance.treeGrid;
9190
}));
9291

@@ -196,10 +195,9 @@ describe('IgxTreeGrid - Integration', () => {
196195

197196
describe('Primary/Foreign key', () => {
198197
// configureTestSuite();
199-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
198+
beforeEach(async(/** height/width setter rAF */() => {
200199
fix = TestBed.createComponent(IgxTreeGridPrimaryForeignKeyComponent);
201200
fix.detectChanges();
202-
tick(16);
203201
treeGrid = fix.componentInstance.treeGrid;
204202
}));
205203

@@ -308,10 +306,9 @@ describe('IgxTreeGrid - Integration', () => {
308306
});
309307

310308
describe('Row editing', () => {
311-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
309+
beforeEach(async(/** height/width setter rAF */() => {
312310
fix = TestBed.createComponent(IgxTreeGridRowEditingComponent);
313311
fix.detectChanges();
314-
tick(16);
315312
treeGrid = fix.componentInstance.treeGrid;
316313
}));
317314

@@ -1165,10 +1162,9 @@ describe('IgxTreeGrid - Integration', () => {
11651162
});
11661163

11671164
describe('Multi-column header', () => {
1168-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
1165+
beforeEach(async(/** height/width setter rAF */() => {
11691166
fix = TestBed.createComponent(IgxTreeGridMultiColHeadersComponent);
11701167
fix.detectChanges();
1171-
tick(16);
11721168
treeGrid = fix.componentInstance.treeGrid;
11731169
}));
11741170

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-keyBoardNav.spec.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ describe('IgxTreeGrid - Key Board Navigation', () => {
3030
describe('Navigation with no scroll', () => {
3131
// configureTestSuite();
3232

33-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
33+
beforeEach(async(/** height/width setter rAF */() => {
3434
fix = TestBed.createComponent(IgxTreeGridWithNoScrollsComponent);
3535
fix.detectChanges();
36-
tick(16);
3736
treeGrid = fix.componentInstance.treeGrid;
3837
}));
3938

@@ -157,13 +156,12 @@ describe('IgxTreeGrid - Key Board Navigation', () => {
157156
describe('Navigation with scrolls', () => {
158157
// configureTestSuite();
159158

160-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
159+
beforeEach(async(/** height/width setter rAF */() => {
161160
fix = TestBed.createComponent(IgxTreeGridWithScrollsComponent);
162161
fix.detectChanges();
163-
tick(16);
162+
164163
treeGrid = fix.componentInstance.treeGrid;
165164
setupGridScrollDetection(fix, treeGrid);
166-
tick(16);
167165
}));
168166

169167
it('should navigate with arrow Up and Down keys on gridCells', async () => {

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-search.spec.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,14 @@ describe('IgxTreeGrid - search API', () => {
3434
}));
3535

3636
describe('Child Collection', () => {
37-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
37+
beforeEach(async(/** height/width setter rAF */() => {
3838
fix = TestBed.createComponent(IgxTreeGridSearchComponent);
3939
fix.detectChanges();
40-
tick(16);
4140
fixNativeElement = fix.debugElement.nativeElement;
4241
treeGrid = fix.componentInstance.treeGrid;
4342

4443
treeGrid.getColumnByName('JobTitle').autosize();
4544
fix.detectChanges();
46-
tick(16);
4745
}));
4846

4947
it('Search highlights should work within tree cell', () => {
@@ -113,10 +111,9 @@ describe('IgxTreeGrid - search API', () => {
113111
});
114112

115113
describe('Primary/Foreign key', () => {
116-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
114+
beforeEach(async(/** height/width setter rAF */() => {
117115
fix = TestBed.createComponent(IgxTreeGridPrimaryForeignKeyComponent);
118116
fix.detectChanges();
119-
tick(16);
120117
fixNativeElement = fix.debugElement.nativeElement;
121118
treeGrid = fix.componentInstance.treeGrid;
122119
}));

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-selection.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,10 +407,9 @@ describe('IgxTreeGrid - Selection', () => {
407407

408408
describe('Cell Selection', () => {
409409
// configureTestSuite();
410-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
410+
beforeEach(async(/** height/width setter rAF */() => {
411411
fix = TestBed.createComponent(IgxTreeGridCellSelectionComponent);
412412
fix.detectChanges();
413-
tick(16);
414413
treeGrid = fix.componentInstance.treeGrid;
415414
}));
416415

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-sorting.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ describe('IgxTreeGrid - Sorting', () => {
2323
.compileComponents();
2424
}));
2525

26-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
26+
beforeEach(async(/** height/width setter rAF */() => {
2727
fix = TestBed.createComponent(IgxTreeGridSortingComponent);
2828
fix.detectChanges();
29-
tick(16);
3029
treeGrid = fix.componentInstance.treeGrid;
3130
}));
3231

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid-summaries.spec.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -678,13 +678,11 @@ describe('IgxTreeGrid - Summaries', () => {
678678
describe('CRUD with transactions', () => {
679679
let fix;
680680
let treeGrid;
681-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
681+
beforeEach(async(/** height/width setter rAF */() => {
682682
fix = TestBed.createComponent(IgxTreeGridSummariesTransactionsComponent);
683683
fix.detectChanges();
684-
tick(16);
685684
treeGrid = fix.componentInstance.treeGrid;
686685
setupGridScrollDetection(fix, treeGrid);
687-
tick(16);
688686
}));
689687

690688
it('Delete root node', () => {
@@ -1195,13 +1193,11 @@ describe('IgxTreeGrid - Summaries', () => {
11951193
describe('Keyboard Navigation', () => {
11961194
let fix;
11971195
let treeGrid;
1198-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
1196+
beforeEach(async(/** height/width setter rAF */() => {
11991197
fix = TestBed.createComponent(IgxTreeGridSummariesKeyScroliingComponent);
12001198
fix.detectChanges();
1201-
tick(16);
12021199
treeGrid = fix.componentInstance.treeGrid;
12031200
setupGridScrollDetection(fix, treeGrid);
1204-
tick(16);
12051201
}));
12061202

12071203
it('should be able to select root summaries with arrow keys', async () => {

projects/igniteui-angular/src/lib/grids/tree-grid/tree-grid.component.spec.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ describe('IgxTreeGrid Component Tests', () => {
3232

3333
describe('IgxTreeGrid - default rendering for rows and columns', () => {
3434

35-
beforeEach(fakeAsync(/** height/width setter rAF */() => {
35+
beforeEach(async(/** height/width setter rAF */() => {
3636
fix = TestBed.createComponent(IgxTreeGridWrappedInContComponent);
3737
fix.detectChanges();
38-
tick(16);
3938
grid = fix.componentInstance.treeGrid;
4039
}));
4140

0 commit comments

Comments
 (0)