/
pop.component.spec.ts
41 lines (36 loc) · 1.16 KB
/
pop.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
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PopComponent } from './pop.component';
import { CommonModule } from '@angular/common';
import { IconModule, ModalComponent, PopService } from '../../public_api';
describe('PopComponent', () => {
let component: PopComponent;
let fixture: ComponentFixture<PopComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [PopComponent, ModalComponent],
imports: [CommonModule, IconModule],
providers: [PopService],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(PopComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should toggle', () => {
expect(component.active).toBeUndefined();
component.toggle();
expect(component.active).toBe(true);
component.toggle();
});
it('should hide', () => {
expect(component.active).toBeUndefined();
component.show();
expect(component.active).toBe(true);
component.hide();
expect(component.active).toBe(false);
});
});