Skip to content

tests(prograssBar): Fix tests for Circular and Linear Bars not clearing test bed. #15663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: 19.2.x
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { IgxActionStripComponent, IgxActionStripMenuItemDirective } from './action-strip.component';
import { Component, ViewChild, ElementRef, ViewContainerRef } from '@angular/core';
import { configureTestSuite } from '../test-utils/configure-suite';
import { TestBed } from '@angular/core/testing';
import { TestBed, waitForAsync } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { wait } from '../test-utils/ui-interactions.spec';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
Expand All @@ -17,17 +16,17 @@ describe('igxActionStrip', () => {
let parentContainer: ElementRef;
let innerContainer: ViewContainerRef;

configureTestSuite(() => {
return TestBed.configureTestingModule({
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
NoopAnimationsModule,
IgxActionStripComponent,
IgxActionStripTestingComponent,
IgxActionStripMenuTestingComponent,
IgxActionStripCombinedMenuTestingComponent
]
});
});
}).compileComponents();
}));

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

Expand Down
11 changes: 5 additions & 6 deletions projects/igniteui-angular/src/lib/combo/combo.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AsyncPipe } from '@angular/common';
import { AfterViewInit, ChangeDetectorRef, Component, DebugElement, ElementRef, Injectable, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
import {
FormsModule, NgControl, NgForm, NgModel, ReactiveFormsModule, UntypedFormBuilder, UntypedFormControl, UntypedFormGroup, Validators
} from '@angular/forms';
Expand All @@ -15,7 +15,6 @@ import { IForOfState } from '../directives/for-of/for_of.directive';
import { IgxInputState } from '../directives/input/input.directive';
import { IgxLabelDirective } from '../input-group/public_api';
import { AbsoluteScrollStrategy, ConnectedPositioningStrategy } from '../services/public_api';
import { configureTestSuite } from '../test-utils/configure-suite';
import { UIInteractions, wait } from '../test-utils/ui-interactions.spec';
import { IgxComboAddItemComponent } from './combo-add-item.component';
import { IgxComboDropDownComponent } from './combo-dropdown.component';
Expand Down Expand Up @@ -986,8 +985,8 @@ describe('igxCombo', () => {
});

describe('Combo feature tests: ', () => {
configureTestSuite(() => {
return TestBed.configureTestingModule({
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
NoopAnimationsModule,
IgxComboSampleComponent,
Expand All @@ -998,8 +997,8 @@ describe('igxCombo', () => {
IgxComboFormComponent,
IgxComboInTemplatedFormComponent
]
});
});
}).compileComponents();
}));

describe('Initialization and rendering tests: ', () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { DateTimeUtil } from './date-time.util';
import { DatePart, DatePartInfo } from '../../directives/date-time-editor/date-time-editor.common';
import { DataType } from '../../data-operations/data-util';
import { registerLocaleData } from '@angular/common';
import localeBg from "@angular/common/locales/bg";

const reduceToDictionary = (parts: DatePartInfo[]) => parts.reduce((obj, x) => {
obj[x.type] = x;
return obj;
}, {});

describe(`DateTimeUtil Unit tests`, () => {
registerLocaleData(localeBg);
describe('Date Time Parsing', () => {
it('should correctly parse all date time parts (base)', () => {
let result = DateTimeUtil.parseDateTimeFormat('dd/MM/yyyy HH:mm:ss:SS a');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import localeES from "@angular/common/locales/es";
import localeBg from "@angular/common/locales/bg";
import { IgxDateTimeEditorDirective } from '../directives/date-time-editor/public_api';

const CSS_CLASS_CALENDAR = 'igx-calendar';
const CSS_CLASS_DATE_PICKER = 'igx-date-picker';

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

describe('IgxDatePicker', () => {
describe('Integration tests', () => {
configureTestSuite();
beforeAll(waitForAsync(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
NoopAnimationsModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Component, ViewChildren, QueryList, ViewChild, ElementRef, TemplateRef,
import { TestBed, ComponentFixture, waitForAsync } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { UIInteractions, wait} from '../../test-utils/ui-interactions.spec';
import { configureTestSuite } from '../../test-utils/configure-suite';
import { first } from 'rxjs/operators';
import { IgxInsertDropStrategy, IgxAppendDropStrategy, IgxPrependDropStrategy } from './drag-drop.strategy';
import {
Expand All @@ -22,8 +21,7 @@ describe('General igxDrag/igxDrop', () => {
let dropAreaRects = { top: 0, left: 0, right: 0, bottom: 0};
let dragDirsRects = [{ top: 0, left: 0, right: 0, bottom: 0}];

configureTestSuite({ checkLeaks: true });
beforeAll(waitForAsync(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [TestDragDropComponent]
})
Expand Down Expand Up @@ -1393,8 +1391,7 @@ describe('General igxDrag/igxDrop', () => {
});

describe('Linked igxDrag/igxDrop ', () => {
configureTestSuite();
beforeAll(waitForAsync(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
TestDragDropLinkedSingleComponent,
Expand Down Expand Up @@ -1876,8 +1873,7 @@ describe('Linked igxDrag/igxDrop ', () => {
});

describe('Nested igxDrag elements', () => {
configureTestSuite();
beforeAll(waitForAsync(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [TestDragDropNestedComponent]
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ import {
Pipe,
PipeTransform
} from '@angular/core';
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { TestBed, ComponentFixture, waitForAsync } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { BehaviorSubject, Observable } from 'rxjs';
import { IForOfState, IgxForOfDirective } from './for_of.directive';
import { UIInteractions, wait } from '../../test-utils/ui-interactions.spec';

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

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

describe('empty virtual component', () => {
configureTestSuite((() => {
beforeEach(waitForAsync(() => {
return TestBed.configureTestingModule({
imports: [EmptyVirtualComponent]
});
}).compileComponents();
}));

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

configureTestSuite((() => {
beforeEach(waitForAsync(() => {
return TestBed.configureTestingModule({
imports: [HorizontalVirtualComponent]
});
}).compileComponents();
}));

beforeEach(() => {
Expand Down Expand Up @@ -222,10 +221,12 @@ describe('IgxForOf directive -', () => {

describe('vertical virtual component', () => {
let fix: ComponentFixture<VerticalVirtualComponent>;
configureTestSuite((() => {
return TestBed.configureTestingModule({
imports: [VerticalVirtualNoDataComponent, VerticalVirtualComponent]
});
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
VerticalVirtualNoDataComponent, VerticalVirtualComponent
]
}).compileComponents();
}));

beforeEach(() => {
Expand Down Expand Up @@ -386,10 +387,12 @@ describe('IgxForOf directive -', () => {

describe('vertical virtual component no data', () => {
let fix: ComponentFixture<VerticalVirtualComponent>;
configureTestSuite((() => {
return TestBed.configureTestingModule({
imports: [VerticalVirtualNoDataComponent, VerticalVirtualComponent]
});
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
VerticalVirtualNoDataComponent, VerticalVirtualComponent
]
}).compileComponents();
}));

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

configureTestSuite((() => {
return TestBed.configureTestingModule({
imports: [VirtualComponent]
});
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
VirtualComponent
]
}).compileComponents();
}));

beforeEach(() => {
Expand Down Expand Up @@ -1002,10 +1007,12 @@ describe('IgxForOf directive -', () => {
});

describe('variable size component', () => {
configureTestSuite((() => {
return TestBed.configureTestingModule({
imports: [VirtualVariableSizeComponent]
});
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
VirtualVariableSizeComponent
]
}).compileComponents();
}));

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

describe('remote virtual component', () => {
configureTestSuite((() => {
return TestBed.configureTestingModule({
imports: [RemoteVirtualizationComponent]
});
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
RemoteVirtualizationComponent
]
}).compileComponents();
}));

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

describe('remote virtual component with specified igxForTotalItemCount', () => {
configureTestSuite((() => {
return TestBed.configureTestingModule({
imports: [RemoteVirtCountComponent]
});
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
RemoteVirtCountComponent
]
}).compileComponents();
}));

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

describe('no width and height component', () => {
configureTestSuite((() => {
return TestBed.configureTestingModule({
imports: [NoWidthAndHeightComponent]
});
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
NoWidthAndHeightComponent
]
}).compileComponents();
}));

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

describe('even odd first last functions', () => {
configureTestSuite((() => {
return TestBed.configureTestingModule({
imports: [LocalVariablesComponent]
});
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
LocalVariablesComponent
]
}).compileComponents();
}));

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

describe('`as` syntax', () => {
configureTestSuite((() => {
return TestBed.configureTestingModule({
imports: [LocalVariablesAsComponent]
});
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
LocalVariablesAsComponent
]
}).compileComponents();
}));

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

configureTestSuite((() => {
return TestBed.configureTestingModule({
imports: [VerticalVirtualDestroyComponent]
});
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
VerticalVirtualDestroyComponent
]
}).compileComponents();
}));

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

configureTestSuite((() => {
return TestBed.configureTestingModule({
imports: [VerticalVirtualCreateComponent]
});
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
VerticalVirtualCreateComponent
]
}).compileComponents();
}));

beforeEach(() => {
fix = TestBed.createComponent(VerticalVirtualCreateComponent);
fix.componentInstance.data = dg.generateVerticalData(fix.componentInstance.cols);
fix.componentRef.hostView.detectChanges();
fix.detectChanges();

});

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