-
Notifications
You must be signed in to change notification settings - Fork 112
/
Copy pathdynamic-css-classes.component.spec.ts
43 lines (35 loc) · 1.33 KB
/
dynamic-css-classes.component.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* tslint:disable:no-unused-variable */
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DynamicCssClassesComponent } from './dynamic-css-classes.component';
describe('DynamicCssClassesComponent', () => {
let component: DynamicCssClassesComponent;
let fixture: ComponentFixture<DynamicCssClassesComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [DynamicCssClassesComponent]
});
}));
beforeEach(() => {
fixture = TestBed.createComponent(DynamicCssClassesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should have the .alert class if isAlert is set to true', () => {
component.isAlert = true;
fixture.detectChanges();
let classes: any = fixture.debugElement.query(By.css('div')).classes;
expect(classes.alert).toBeTruthy();
expect(classes.success).toBeFalsy();
});
it('should have the .success class if isAlert is set to false', () => {
component.isAlert = false;
fixture.detectChanges();
let classes: any = fixture.debugElement.query(By.css('div')).classes;
expect(classes.success).toBeTruthy();
expect(classes.alert).toBeFalsy();
});
});