This repository has been archived by the owner on May 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(icon): default icon bug fixed (#137)
* fix(icon): default icon bug fixed * fix(alm-icon-test): added unit test for alm icon directive
- Loading branch information
1 parent
f25de7d
commit 93847e3
Showing
3 changed files
with
73 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { Component } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'alm-icon-test', | ||
template: '' | ||
}) | ||
|
||
export class AlmIconTest {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { By } from '@angular/platform-browser'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { AlmIconTest } from './almicon-test.component'; | ||
import { AlmIconDirective } from './almicon.directive'; | ||
|
||
describe('AlmIcon directive - ', () => { | ||
let comp: AlmIconTest; | ||
let fixture: ComponentFixture<AlmIconTest>; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({ | ||
declarations: [ | ||
AlmIconTest, | ||
AlmIconDirective | ||
] | ||
}); | ||
}); | ||
|
||
it('Canary test should pass', () => { | ||
expect(true).toBeTruthy(); | ||
}); | ||
|
||
it('Should apply appropriate class and color', () => { | ||
TestBed.overrideComponent(AlmIconTest, { | ||
set: { | ||
template: '<span almIcon iconType="new"></span>' | ||
} | ||
}) | ||
.compileComponents() | ||
.then(() => { | ||
fixture = TestBed.createComponent(AlmIconTest); | ||
comp = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
let compiled = fixture.debugElement.nativeElement | ||
.querySelector('span'); | ||
expect(compiled.className).toBe('fa fa-star'); | ||
expect(compiled.style.color).toBe('rgb(88, 47, 192)'); | ||
}); | ||
}); | ||
|
||
it('Should apply default class and color', () => { | ||
TestBed.overrideComponent(AlmIconTest, { | ||
set: { | ||
template: '<span almIcon iconType="anything"></span>' | ||
} | ||
}) | ||
.compileComponents() | ||
.then(() => { | ||
fixture = TestBed.createComponent(AlmIconTest); | ||
comp = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
let compiled = fixture.debugElement.nativeElement | ||
.querySelector('span'); | ||
expect(compiled.className).toBe('fa fa-crosshairs'); | ||
expect(compiled.style.color).toBe('rgb(0, 0, 0)'); | ||
}); | ||
}); | ||
|
||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters