Skip to content

Commit 4782667

Browse files
CopilotChronosSF
andcommitted
Phase 3: Convert spec files from Jasmine to Vitest syntax (automated conversion)
Co-authored-by: ChronosSF <2188411+ChronosSF@users.noreply.github.com>
1 parent c5b8edd commit 4782667

File tree

242 files changed

+2463
-1815
lines changed

Some content is hidden

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

242 files changed

+2463
-1815
lines changed

projects/bundle-test/src/app/app.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { TestBed } from '@angular/core/testing';
22
import { AppComponent } from './app.component';
33

4+
import { describe, it, expect, beforeEach } from 'vitest';
45
describe('AppComponent', () => {
56
beforeEach(() => TestBed.configureTestingModule({
67
imports: [AppComponent]

projects/igniteui-angular-elements/src/app/custom-strategy.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
} from './components';
1818
import { defineComponents } from '../utils/register';
1919

20+
import { describe, it, expect, beforeEach, afterEach, beforeAll } from 'vitest';
2021
describe('Elements: ', () => {
2122
let testContainer: HTMLDivElement;
2223

projects/igniteui-angular-elements/src/app/wrapper/wrapper.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { html } from 'lit';
33
import { AsyncDirective, directive } from 'lit/async-directive.js';
44
import { TemplateWrapperComponent } from './wrapper.component';
55

6+
import { describe, it, expect, beforeEach } from 'vitest';
67
const directiveLog = [];
78
class ToLowerAsyncDirective extends AsyncDirective {
89
public override render(text: string) {

projects/igniteui-angular-elements/src/lib/icon.broadcast.service.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Component, inject } from '@angular/core';
44
import { IconMeta, IgxIconService } from 'igniteui-angular';
55
import { wait } from 'igniteui-angular/test-utils/ui-interactions.spec';
66

7+
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
78
describe('Icon broadcast service', () => {
89
let fixture: ComponentFixture<BroadcastServiceComponent>;
910
let broadcastChannel: BroadcastChannel;

projects/igniteui-angular-performance/src/app/app.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { AppComponent } from './app.component';
44

5+
import { describe, it, expect, beforeEach } from 'vitest';
56
describe('AppComponent', () => {
67
let component: AppComponent;
78
let fixture: ComponentFixture<AppComponent>;

projects/igniteui-angular/accordion/src/accordion/accordion.component.spec.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { IAccordionCancelableEventArgs, IAccordionEventArgs, IgxAccordionCompone
88
import { slideInLeft, slideOutRight } from 'igniteui-angular/animations';
99
import { UIInteractions } from 'igniteui-angular/test-utils/ui-interactions.spec';
1010

11+
import { describe, it, expect, beforeEach, vi } from 'vitest';
1112
const ACCORDION_CLASS = 'igx-accordion';
1213
const PANEL_TAG = 'IGX-EXPANSION-PANEL';
1314
const ACCORDION_TAG = 'IGX-ACCORDION';
@@ -69,8 +70,8 @@ describe('Rendering Tests', () => {
6970

7071
it(`Should be able to expand only one panel when singleBranchExpanded is set to true
7172
and expandAll/collapseAll should not update the current expansion state `, fakeAsync(() => {
72-
spyOn(accordion.panelExpanded, 'emit').and.callThrough();
73-
spyOn(accordion.panelCollapsed, 'emit').and.callThrough();
73+
vi.spyOn(accordion.panelExpanded, 'emit');
74+
vi.spyOn(accordion.panelCollapsed, 'emit');
7475
accordion.singleBranchExpand = true;
7576
fix.detectChanges();
7677

@@ -138,8 +139,8 @@ describe('Rendering Tests', () => {
138139

139140
it(`Should update the current expansion state when expandAll/collapseAll is invoked and
140141
singleBranchExpaned is set to false`, fakeAsync(() => {
141-
spyOn(accordion.panelExpanded, 'emit').and.callThrough();
142-
spyOn(accordion.panelCollapsed, 'emit').and.callThrough();
142+
vi.spyOn(accordion.panelExpanded, 'emit');
143+
vi.spyOn(accordion.panelCollapsed, 'emit');
143144
accordion.singleBranchExpand = false;
144145
accordion.panels[3].collapse();
145146
tick();
@@ -184,15 +185,15 @@ describe('Rendering Tests', () => {
184185
});
185186

186187
it('Should emit ing and ed events when expand panel state is toggled', fakeAsync(() => {
187-
spyOn(accordion.panelExpanded, 'emit').and.callThrough();
188-
spyOn(accordion.panelExpanding, 'emit').and.callThrough();
189-
spyOn(accordion.panelCollapsed, 'emit').and.callThrough();
190-
spyOn(accordion.panelCollapsing, 'emit').and.callThrough();
191-
192-
spyOn(accordion.panels[0].contentCollapsing, 'emit').and.callThrough();
193-
spyOn(accordion.panels[0].contentCollapsed, 'emit').and.callThrough();
194-
spyOn(accordion.panels[0].contentExpanding, 'emit').and.callThrough();
195-
spyOn(accordion.panels[0].contentExpanded, 'emit').and.callThrough();
188+
vi.spyOn(accordion.panelExpanded, 'emit');
189+
vi.spyOn(accordion.panelExpanding, 'emit');
190+
vi.spyOn(accordion.panelCollapsed, 'emit');
191+
vi.spyOn(accordion.panelCollapsing, 'emit');
192+
193+
vi.spyOn(accordion.panels[0].contentCollapsing, 'emit');
194+
vi.spyOn(accordion.panels[0].contentCollapsed, 'emit');
195+
vi.spyOn(accordion.panels[0].contentExpanding, 'emit');
196+
vi.spyOn(accordion.panels[0].contentExpanded, 'emit');
196197

197198
accordion.singleBranchExpand = false;
198199
fix.detectChanges();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
66
import { IgxIconComponent } from 'igniteui-angular/icon';
77
import { wait } from '../../../test-utils/ui-interactions.spec';
88

9+
import { describe, it, expect, beforeEach } from 'vitest';
910
const ACTION_STRIP_CONTAINER_CSS = 'igx-action-strip__actions';
1011
const DROP_DOWN_LIST = 'igx-drop-down__list';
1112

projects/igniteui-angular/avatar/src/avatar/avatar.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { TestBed, waitForAsync } from '@angular/core/testing';
33
import { By } from '@angular/platform-browser';
44
import { IgxAvatarComponent, IgxAvatarType, IgxAvatarSize } from './avatar.component';
55

6+
import { describe, it, expect, beforeEach } from 'vitest';
67
describe('Avatar', () => {
78
const baseClass = 'igx-avatar';
89

projects/igniteui-angular/badge/src/badge/badge.component.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { TestBed, waitForAsync } from '@angular/core/testing';
33
import { By } from '@angular/platform-browser';
44
import { IgxBadgeComponent, IgxBadgeType } from './badge.component';
55

6+
import { describe, it, expect, beforeEach } from 'vitest';
67
describe('Badge', () => {
78
beforeEach(waitForAsync(() => {
89
TestBed.configureTestingModule({

projects/igniteui-angular/banner/src/banner/banner.component.spec.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { IgxBannerActionsDirective } from './banner.directives';
88
import { IgxCardComponent, IgxCardContentDirective, IgxCardHeaderComponent } from 'igniteui-angular/card';
99
import { IgxAvatarComponent } from 'igniteui-angular/avatar';
1010

11+
import { describe, it, expect, beforeEach, vi } from 'vitest';
1112
const CSS_CLASS_EXPANSION_PANEL = 'igx-expansion-panel';
1213
const CSS_CLASS_EXPANSION_PANEL_BODY = 'igx-expansion-panel__body';
1314
const CSS_CLASS_BANNER = 'igx-banner';
@@ -231,12 +232,12 @@ describe('igxBanner', () => {
231232
const banner = fixture.componentInstance.banner;
232233
expect(banner.collapsed).toBeTruthy();
233234

234-
spyOn(banner.opened, 'emit');
235-
spyOn(banner.closed, 'emit');
236-
spyOn(banner, 'onExpansionPanelClose').and.callThrough();
237-
spyOn(banner, 'onExpansionPanelOpen').and.callThrough();
238-
spyOn(banner, 'open').and.callThrough();
239-
spyOn(banner, 'close').and.callThrough();
235+
vi.spyOn(banner.opened, 'emit');
236+
vi.spyOn(banner.closed, 'emit');
237+
vi.spyOn(banner, 'onExpansionPanelClose');
238+
vi.spyOn(banner, 'onExpansionPanelOpen');
239+
vi.spyOn(banner, 'open');
240+
vi.spyOn(banner, 'close');
240241

241242
banner.open();
242243
tick();
@@ -337,10 +338,10 @@ describe('igxBanner', () => {
337338
const fixture = TestBed.createComponent(IgxBannerSampleComponent);
338339
fixture.detectChanges();
339340
const banner = fixture.componentInstance.banner;
340-
spyOn(banner.closed, 'emit');
341-
spyOn(banner.closing, 'emit');
342-
spyOn(banner.opened, 'emit');
343-
spyOn(banner.opening, 'emit');
341+
vi.spyOn(banner.closed, 'emit');
342+
vi.spyOn(banner.closing, 'emit');
343+
vi.spyOn(banner.opened, 'emit');
344+
vi.spyOn(banner.opening, 'emit');
344345
expect(banner.collapsed).toEqual(true);
345346
expect(banner.opening.emit).toHaveBeenCalledTimes(0);
346347
expect(banner.opened.emit).toHaveBeenCalledTimes(0);
@@ -364,10 +365,10 @@ describe('igxBanner', () => {
364365
const fixture = TestBed.createComponent(SimpleBannerEventsComponent);
365366
fixture.detectChanges();
366367
const banner = fixture.componentInstance.banner;
367-
spyOn(banner.closing, 'emit').and.callThrough();
368-
spyOn(banner.opening, 'emit').and.callThrough();
369-
spyOn(banner.closed, 'emit').and.callThrough();
370-
spyOn(banner.opened, 'emit').and.callThrough();
368+
vi.spyOn(banner.closing, 'emit');
369+
vi.spyOn(banner.opening, 'emit');
370+
vi.spyOn(banner.closed, 'emit');
371+
vi.spyOn(banner.opened, 'emit');
371372
expect(banner.collapsed).toEqual(true);
372373
fixture.componentInstance.cancelFlag = true;
373374
banner.toggle();

0 commit comments

Comments
 (0)