Skip to content

Commit 19faa3e

Browse files
committed
fix(igx-ts): fix guages problems in spec files
1 parent 3fbb229 commit 19faa3e

6 files changed

Lines changed: 48 additions & 35 deletions

File tree

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
2-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
32
import { IgxBulletGraphModule } from 'igniteui-angular-gauges';
43
import { <%=ClassName%> } from './<%=filePrefix%>';
5-
import * as igGauges from 'igniteui-angular-gauges';
64

75
describe('<%=ClassName%>', () => {
86
let component: <%=ClassName%>;
97
let fixture: ComponentFixture<<%=ClassName%>>;
108

11-
// mock method specific to BulletGraph
12-
vi.spyOn(igGauges.XamBulletGraph.prototype, 'fb').mockImplementation(() => { /* mock */ });
13-
149
beforeEach(async () => {
1510
await TestBed.configureTestingModule({
1611
declarations: [<%=ClassName%>],
17-
imports: [IgxBulletGraphModule, NoopAnimationsModule]
12+
imports: [IgxBulletGraphModule]
1813
})
1914
.compileComponents();
2015
});
2116

2217
beforeEach(() => {
18+
vi.useFakeTimers();
2319
fixture = TestBed.createComponent(<%=ClassName%>);
2420
component = fixture.componentInstance;
2521
fixture.detectChanges();
2622
// disable animation
2723
component.bulletGraph.transitionDuration = 0;
2824
});
2925

26+
afterEach(() => {
27+
vi.useRealTimers();
28+
fixture.destroy();
29+
});
30+
3031
it('should create', () => {
32+
vi.advanceTimersByTime(1000);
3133
expect(component).toBeTruthy();
3234
});
3335
});

packages/igx-templates/igx-ts-legacy/linear-gauge/default/files/src/app/__path__/__filePrefix__.spec.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
2-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
32
import { IgxLinearGaugeModule } from 'igniteui-angular-gauges';
43
import { <%=ClassName%> } from './<%=filePrefix%>';
54
import * as gauges from 'igniteui-angular-gauges';
@@ -8,24 +7,28 @@ describe('<%=ClassName%>', () => {
87
let component: <%=ClassName%>;
98
let fixture: ComponentFixture<<%=ClassName%>>;
109

11-
// mock method specific to LinearGauge
12-
vi.spyOn(gauges.XamLinearGaugeView.prototype, 'ar').mockImplementation(() => { /* mock */ });
13-
1410
beforeEach(async () => {
1511
await TestBed.configureTestingModule({
1612
declarations: [<%=ClassName%>],
17-
imports: [IgxLinearGaugeModule, NoopAnimationsModule]
13+
imports: [IgxLinearGaugeModule]
1814
})
1915
.compileComponents();
2016
});
2117

2218
beforeEach(() => {
19+
vi.useFakeTimers();
2320
fixture = TestBed.createComponent(<%=ClassName%>);
2421
component = fixture.componentInstance;
2522
fixture.detectChanges();
2623
});
2724

25+
afterEach(() => {
26+
vi.useRealTimers();
27+
fixture.destroy();
28+
});
29+
2830
it('should create', () => {
31+
vi.advanceTimersByTime(1000);
2932
expect(component).toBeTruthy();
3033
// disable animation
3134
component.linearGauge.transitionDuration = 0;

packages/igx-templates/igx-ts-legacy/radial-gauge/default/files/src/app/__path__/__filePrefix__.spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
2-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
32
import { IgxRadialGaugeModule } from 'igniteui-angular-gauges';
43
import { <%=ClassName%> } from './<%=filePrefix%>';
5-
import * as igGauges from 'igniteui-angular-gauges';
64

75
describe('<%=ClassName%>', () => {
86
let component: <%=ClassName%>;
97
let fixture: ComponentFixture<<%=ClassName%>>;
108

11-
// mock method specific to RadialGauge
12-
vi.spyOn(igGauges.XamRadialGauge.prototype, 'im').mockImplementation(() => { /* mock */ });
13-
149
beforeEach(async () => {
1510
await TestBed.configureTestingModule({
1611
declarations: [<%=ClassName%>],
17-
imports: [IgxRadialGaugeModule, NoopAnimationsModule]
12+
imports: [IgxRadialGaugeModule]
1813
})
1914
.compileComponents();
2015
});
2116

2217
beforeEach(() => {
18+
vi.useFakeTimers();
2319
fixture = TestBed.createComponent(<%=ClassName%>);
2420
component = fixture.componentInstance;
2521
fixture.detectChanges();
2622
});
2723

24+
afterEach(() => {
25+
vi.useRealTimers();
26+
fixture.destroy();
27+
});
28+
2829
it('should create', () => {
30+
vi.advanceTimersByTime(1000);
2931
expect(component).toBeTruthy();
3032
// disable animation
3133
component.radialGauge.transitionDuration = 0;
Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
2-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
32
import { IgxBulletGraphModule } from 'igniteui-angular-gauges';
43
import { <%=ClassName%> } from './<%=filePrefix%>';
5-
import * as igGauges from 'igniteui-angular-gauges';
64

75
describe('<%=ClassName%>', () => {
86
let component: <%=ClassName%>;
97
let fixture: ComponentFixture<<%=ClassName%>>;
108

11-
// mock method specific to BulletGraph
12-
vi.spyOn(igGauges.XamBulletGraph.prototype, 'fb').mockImplementation(() => { /* mock */ });
13-
149
beforeEach(async () => {
1510
await TestBed.configureTestingModule({
16-
imports: [IgxBulletGraphModule, NoopAnimationsModule, <%=ClassName%>]
11+
imports: [IgxBulletGraphModule, <%=ClassName%>]
1712
})
1813
.compileComponents();
1914
});
2015

2116
beforeEach(() => {
17+
vi.useFakeTimers();
2218
fixture = TestBed.createComponent(<%=ClassName%>);
2319
component = fixture.componentInstance;
2420
fixture.detectChanges();
2521
// disable animation
2622
component.bulletGraph.transitionDuration = 0;
2723
});
2824

25+
afterEach(() => {
26+
vi.useRealTimers();
27+
fixture.destroy();
28+
});
29+
2930
it('should create', () => {
31+
vi.advanceTimersByTime(1000);
3032
expect(component).toBeTruthy();
3133
});
3234
});

packages/igx-templates/igx-ts/linear-gauge/default/files/src/app/__path__/__filePrefix__.spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
2-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
32
import { IgxLinearGaugeModule } from 'igniteui-angular-gauges';
43
import { <%=ClassName%> } from './<%=filePrefix%>';
5-
import * as gauges from 'igniteui-angular-gauges';
64

75
describe('<%=ClassName%>', () => {
86
let component: <%=ClassName%>;
97
let fixture: ComponentFixture<<%=ClassName%>>;
108

11-
// mock method specific to LinearGauge
12-
vi.spyOn(gauges.XamLinearGaugeView.prototype, 'ar').mockImplementation(() => { /* mock */ });
13-
149
beforeEach(async () => {
1510
await TestBed.configureTestingModule({
16-
imports: [IgxLinearGaugeModule, NoopAnimationsModule, <%=ClassName%>]
11+
imports: [IgxLinearGaugeModule, <%=ClassName%>]
1712
})
1813
.compileComponents();
1914
});
2015

2116
beforeEach(() => {
17+
vi.useFakeTimers();
2218
fixture = TestBed.createComponent(<%=ClassName%>);
2319
component = fixture.componentInstance;
2420
fixture.detectChanges();
2521
});
2622

23+
afterEach(() => {
24+
vi.useRealTimers();
25+
fixture.destroy();
26+
});
27+
2728
it('should create', () => {
29+
vi.advanceTimersByTime(1000);
2830
expect(component).toBeTruthy();
2931
// disable animation
3032
component.linearGauge.transitionDuration = 0;

packages/igx-templates/igx-ts/radial-gauge/default/files/src/app/__path__/__filePrefix__.spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
2-
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
32
import { IgxRadialGaugeModule } from 'igniteui-angular-gauges';
43
import { <%=ClassName%> } from './<%=filePrefix%>';
5-
import * as igGauges from 'igniteui-angular-gauges';
64

75
describe('<%=ClassName%>', () => {
86
let component: <%=ClassName%>;
97
let fixture: ComponentFixture<<%=ClassName%>>;
108

11-
// mock method specific to RadialGauge
12-
vi.spyOn(igGauges.XamRadialGauge.prototype, 'im').mockImplementation(() => { /* mock */ });
13-
149
beforeEach(async () => {
1510
await TestBed.configureTestingModule({
16-
imports: [IgxRadialGaugeModule, NoopAnimationsModule, <%=ClassName%>]
11+
imports: [IgxRadialGaugeModule, <%=ClassName%>]
1712
})
1813
.compileComponents();
1914
});
2015

2116
beforeEach(() => {
17+
vi.useFakeTimers();
2218
fixture = TestBed.createComponent(<%=ClassName%>);
2319
component = fixture.componentInstance;
2420
fixture.detectChanges();
2521
});
2622

23+
afterEach(() => {
24+
vi.useRealTimers();
25+
fixture.destroy();
26+
});
27+
2728
it('should create', () => {
29+
vi.advanceTimersByTime(1000);
2830
expect(component).toBeTruthy();
2931
// disable animation
3032
component.radialGauge.transitionDuration = 0;

0 commit comments

Comments
 (0)