Skip to content

Commit

Permalink
spec(icon-service): fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonoff committed Sep 28, 2021
1 parent 02de7a8 commit 0f9de29
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions projects/igniteui-angular/src/lib/icon/icon.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { TestBed } from '@angular/core/testing';
import { TestBed, fakeAsync } from '@angular/core/testing';
import { IgxIconService } from './icon.service';

import { configureTestSuite } from '../test-utils/configure-suite';
import { first } from 'rxjs/operators';
import { HttpClientModule } from '@angular/common/http';

describe('Icon Service', () => {
fdescribe('Icon Service', () => {
configureTestSuite();
const MY_FONT = 'my-awesome-icons';
const ALIAS = 'awesome';
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('Icon Service', () => {
expect(iconService.familyClassName(ALIAS)).toBe(MY_FONT);
});

it('should add custom svg icon from url', () => {
it('should add custom svg icon from url', fakeAsync((done) => {
const iconService = TestBed.inject(IgxIconService) as IgxIconService;

const name = 'test';
Expand All @@ -65,8 +65,12 @@ describe('Icon Service', () => {

expect(XMLHttpRequest.prototype.open).toHaveBeenCalledTimes(1);
expect(XMLHttpRequest.prototype.send).toHaveBeenCalledTimes(1);
expect(iconService.isSvgIconCached(name, family)).toBeTruthy();
});

iconService.iconLoaded.pipe().subscribe(() => {
expect(iconService.isSvgIconCached(name, family)).toBeTruthy();
done();
});
}));

it('should add custom svg icon from text', () => {
const iconService = TestBed.inject(IgxIconService) as IgxIconService;
Expand Down

0 comments on commit 0f9de29

Please sign in to comment.