Skip to content

Commit 1d1a881

Browse files
committed
refactor(tests): removing configureTestSuite()
1 parent 682ba7f commit 1d1a881

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+376
-340
lines changed

projects/igniteui-angular/src/lib/action-strip/action-strip.component.spec.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { IgxActionStripComponent, IgxActionStripMenuItemDirective } from './action-strip.component';
22
import { Component, ViewChild, ElementRef, ViewContainerRef } from '@angular/core';
3-
import { configureTestSuite } from '../test-utils/configure-suite';
4-
import { TestBed } from '@angular/core/testing';
3+
import { TestBed, waitForAsync } from '@angular/core/testing';
54
import { By } from '@angular/platform-browser';
65
import { wait } from '../test-utils/ui-interactions.spec';
76
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
@@ -17,17 +16,17 @@ describe('igxActionStrip', () => {
1716
let parentContainer: ElementRef;
1817
let innerContainer: ViewContainerRef;
1918

20-
configureTestSuite(() => {
21-
return TestBed.configureTestingModule({
19+
beforeEach(waitForAsync(() => {
20+
TestBed.configureTestingModule({
2221
imports: [
2322
NoopAnimationsModule,
2423
IgxActionStripComponent,
2524
IgxActionStripTestingComponent,
2625
IgxActionStripMenuTestingComponent,
2726
IgxActionStripCombinedMenuTestingComponent
2827
]
29-
});
30-
});
28+
}).compileComponents();
29+
}));
3130

3231
describe('Unit tests: ', () => {
3332

projects/igniteui-angular/src/lib/combo/combo.component.spec.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { AsyncPipe } from '@angular/common';
22
import { AfterViewInit, ChangeDetectorRef, Component, DebugElement, ElementRef, Injectable, OnDestroy, OnInit, ViewChild } from '@angular/core';
3-
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
3+
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
44
import {
55
FormsModule, NgControl, NgForm, NgModel, ReactiveFormsModule, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators
66
} from '@angular/forms';
@@ -15,7 +15,6 @@ import { IForOfState } from '../directives/for-of/for_of.directive';
1515
import { IgxInputState } from '../directives/input/input.directive';
1616
import { IgxLabelDirective } from '../input-group/public_api';
1717
import { AbsoluteScrollStrategy, ConnectedPositioningStrategy } from '../services/public_api';
18-
import { configureTestSuite } from '../test-utils/configure-suite';
1918
import { UIInteractions, wait } from '../test-utils/ui-interactions.spec';
2019
import { IgxComboAddItemComponent } from './combo-add-item.component';
2120
import { IgxComboDropDownComponent } from './combo-dropdown.component';
@@ -986,8 +985,8 @@ describe('igxCombo', () => {
986985
});
987986

988987
describe('Combo feature tests: ', () => {
989-
configureTestSuite(() => {
990-
return TestBed.configureTestingModule({
988+
beforeEach(waitForAsync(() => {
989+
TestBed.configureTestingModule({
991990
imports: [
992991
NoopAnimationsModule,
993992
IgxComboSampleComponent,
@@ -998,8 +997,8 @@ describe('igxCombo', () => {
998997
IgxComboFormComponent,
999998
IgxComboInTemplatedFormComponent
1000999
]
1001-
});
1002-
});
1000+
}).compileComponents();
1001+
}));
10031002

10041003
describe('Initialization and rendering tests: ', () => {
10051004
beforeEach(() => {

projects/igniteui-angular/src/lib/date-picker/date-picker.component.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import localeES from "@angular/common/locales/es";
2626
import localeBg from "@angular/common/locales/bg";
2727
import { IgxDateTimeEditorDirective } from '../directives/date-time-editor/public_api';
2828

29-
const CSS_CLASS_CALENDAR = 'igx-calendar';
3029
const CSS_CLASS_DATE_PICKER = 'igx-date-picker';
3130

3231
const DATE_PICKER_TOGGLE_ICON = 'calendar_today';
@@ -37,8 +36,7 @@ const CSS_CLASS_INPUT_GROUP_INVALID = 'igx-input-group--invalid';
3736

3837
describe('IgxDatePicker', () => {
3938
describe('Integration tests', () => {
40-
configureTestSuite();
41-
beforeAll(waitForAsync(() => {
39+
beforeEach(waitForAsync(() => {
4240
TestBed.configureTestingModule({
4341
imports: [
4442
NoopAnimationsModule,

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.spec.ts

Lines changed: 71 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,12 @@ import {
1717
Pipe,
1818
PipeTransform
1919
} from '@angular/core';
20-
import { TestBed, ComponentFixture } from '@angular/core/testing';
20+
import { TestBed, ComponentFixture, waitForAsync } from '@angular/core/testing';
2121
import { By } from '@angular/platform-browser';
2222
import { BehaviorSubject, Observable } from 'rxjs';
2323
import { IForOfState, IgxForOfDirective } from './for_of.directive';
2424
import { UIInteractions, wait } from '../../test-utils/ui-interactions.spec';
2525

26-
import { configureTestSuite } from '../../test-utils/configure-suite';
2726
import { IgxForOfScrollSyncService } from './for_of.sync.service';
2827
import { PlatformUtil } from '../../core/utils';
2928

@@ -42,10 +41,10 @@ describe('IgxForOf directive -', () => {
4241
});
4342

4443
describe('empty virtual component', () => {
45-
configureTestSuite((() => {
44+
beforeEach(waitForAsync(() => {
4645
return TestBed.configureTestingModule({
4746
imports: [EmptyVirtualComponent]
48-
});
47+
}).compileComponents();
4948
}));
5049

5150
it('should initialize empty directive', () => {
@@ -59,10 +58,10 @@ describe('IgxForOf directive -', () => {
5958
describe('horizontal virtual component', () => {
6059
let fix: ComponentFixture<HorizontalVirtualComponent>;
6160

62-
configureTestSuite((() => {
61+
beforeEach(waitForAsync(() => {
6362
return TestBed.configureTestingModule({
6463
imports: [HorizontalVirtualComponent]
65-
});
64+
}).compileComponents();
6665
}));
6766

6867
beforeEach(() => {
@@ -222,10 +221,12 @@ describe('IgxForOf directive -', () => {
222221

223222
describe('vertical virtual component', () => {
224223
let fix: ComponentFixture<VerticalVirtualComponent>;
225-
configureTestSuite((() => {
226-
return TestBed.configureTestingModule({
227-
imports: [VerticalVirtualNoDataComponent, VerticalVirtualComponent]
228-
});
224+
beforeEach(waitForAsync(() => {
225+
TestBed.configureTestingModule({
226+
imports: [
227+
VerticalVirtualNoDataComponent, VerticalVirtualComponent
228+
]
229+
}).compileComponents();
229230
}));
230231

231232
beforeEach(() => {
@@ -386,10 +387,12 @@ describe('IgxForOf directive -', () => {
386387

387388
describe('vertical virtual component no data', () => {
388389
let fix: ComponentFixture<VerticalVirtualComponent>;
389-
configureTestSuite((() => {
390-
return TestBed.configureTestingModule({
391-
imports: [VerticalVirtualNoDataComponent, VerticalVirtualComponent]
392-
});
390+
beforeEach(waitForAsync(() => {
391+
TestBed.configureTestingModule({
392+
imports: [
393+
VerticalVirtualNoDataComponent, VerticalVirtualComponent
394+
]
395+
}).compileComponents();
393396
}));
394397

395398
beforeEach(() => {
@@ -422,10 +425,12 @@ describe('IgxForOf directive -', () => {
422425
describe('vertical and horizontal virtual component', () => {
423426
let fix: ComponentFixture<VirtualComponent>;
424427

425-
configureTestSuite((() => {
426-
return TestBed.configureTestingModule({
427-
imports: [VirtualComponent]
428-
});
428+
beforeEach(waitForAsync(() => {
429+
TestBed.configureTestingModule({
430+
imports: [
431+
VirtualComponent
432+
]
433+
}).compileComponents();
429434
}));
430435

431436
beforeEach(() => {
@@ -1002,10 +1007,12 @@ describe('IgxForOf directive -', () => {
10021007
});
10031008

10041009
describe('variable size component', () => {
1005-
configureTestSuite((() => {
1006-
return TestBed.configureTestingModule({
1007-
imports: [VirtualVariableSizeComponent]
1008-
});
1010+
beforeEach(waitForAsync(() => {
1011+
TestBed.configureTestingModule({
1012+
imports: [
1013+
VirtualVariableSizeComponent
1014+
]
1015+
}).compileComponents();
10091016
}));
10101017

10111018
it('should update display container classes when content state changes from virtualized to non-virtualized.', () => {
@@ -1043,10 +1050,12 @@ describe('IgxForOf directive -', () => {
10431050
});
10441051

10451052
describe('remote virtual component', () => {
1046-
configureTestSuite((() => {
1047-
return TestBed.configureTestingModule({
1048-
imports: [RemoteVirtualizationComponent]
1049-
});
1053+
beforeEach(waitForAsync(() => {
1054+
TestBed.configureTestingModule({
1055+
imports: [
1056+
RemoteVirtualizationComponent
1057+
]
1058+
}).compileComponents();
10501059
}));
10511060

10521061
it('should allow remote virtualization', async () => {
@@ -1080,10 +1089,12 @@ describe('IgxForOf directive -', () => {
10801089
});
10811090

10821091
describe('remote virtual component with specified igxForTotalItemCount', () => {
1083-
configureTestSuite((() => {
1084-
return TestBed.configureTestingModule({
1085-
imports: [RemoteVirtCountComponent]
1086-
});
1092+
beforeEach(waitForAsync(() => {
1093+
TestBed.configureTestingModule({
1094+
imports: [
1095+
RemoteVirtCountComponent
1096+
]
1097+
}).compileComponents();
10871098
}));
10881099

10891100
it('should apply remote virtualization correctly', async () => {
@@ -1117,10 +1128,12 @@ describe('IgxForOf directive -', () => {
11171128
});
11181129

11191130
describe('no width and height component', () => {
1120-
configureTestSuite((() => {
1121-
return TestBed.configureTestingModule({
1122-
imports: [NoWidthAndHeightComponent]
1123-
});
1131+
beforeEach(waitForAsync(() => {
1132+
TestBed.configureTestingModule({
1133+
imports: [
1134+
NoWidthAndHeightComponent
1135+
]
1136+
}).compileComponents();
11241137
}));
11251138

11261139
it('should use itemSize when no width or height are provided', () => {
@@ -1136,10 +1149,12 @@ describe('IgxForOf directive -', () => {
11361149
});
11371150

11381151
describe('even odd first last functions', () => {
1139-
configureTestSuite((() => {
1140-
return TestBed.configureTestingModule({
1141-
imports: [LocalVariablesComponent]
1142-
});
1152+
beforeEach(waitForAsync(() => {
1153+
TestBed.configureTestingModule({
1154+
imports: [
1155+
LocalVariablesComponent
1156+
]
1157+
}).compileComponents();
11431158
}));
11441159

11451160
it('should differentiate even odd items', () => {
@@ -1164,10 +1179,12 @@ describe('IgxForOf directive -', () => {
11641179
});
11651180

11661181
describe('`as` syntax', () => {
1167-
configureTestSuite((() => {
1168-
return TestBed.configureTestingModule({
1169-
imports: [LocalVariablesAsComponent]
1170-
});
1182+
beforeEach(waitForAsync(() => {
1183+
TestBed.configureTestingModule({
1184+
imports: [
1185+
LocalVariablesAsComponent
1186+
]
1187+
}).compileComponents();
11711188
}));
11721189

11731190
it('should get correct data using `as` syntax', () => {
@@ -1185,10 +1202,12 @@ describe('IgxForOf directive -', () => {
11851202
describe('on destroy', () => {
11861203
let fix: ComponentFixture<VerticalVirtualDestroyComponent>;
11871204

1188-
configureTestSuite((() => {
1189-
return TestBed.configureTestingModule({
1190-
imports: [VerticalVirtualDestroyComponent]
1191-
});
1205+
beforeEach(waitForAsync(() => {
1206+
TestBed.configureTestingModule({
1207+
imports: [
1208+
VerticalVirtualDestroyComponent
1209+
]
1210+
}).compileComponents();
11921211
}));
11931212

11941213
beforeEach(() => {
@@ -1230,18 +1249,19 @@ describe('IgxForOf directive -', () => {
12301249
describe('on create new instance', () => {
12311250
let fix: ComponentFixture<VerticalVirtualCreateComponent>;
12321251

1233-
configureTestSuite((() => {
1234-
return TestBed.configureTestingModule({
1235-
imports: [VerticalVirtualCreateComponent]
1236-
});
1252+
beforeEach(waitForAsync(() => {
1253+
TestBed.configureTestingModule({
1254+
imports: [
1255+
VerticalVirtualCreateComponent
1256+
]
1257+
}).compileComponents();
12371258
}));
12381259

12391260
beforeEach(() => {
12401261
fix = TestBed.createComponent(VerticalVirtualCreateComponent);
12411262
fix.componentInstance.data = dg.generateVerticalData(fix.componentInstance.cols);
12421263
fix.componentRef.hostView.detectChanges();
12431264
fix.detectChanges();
1244-
12451265
});
12461266

12471267
it('should reset scroll position if new component is created.', async () => {

0 commit comments

Comments
 (0)