aboutsummaryrefslogtreecommitdiffstats
path: root/src/angular/form-elements/checkbox/checkbox.component.spec.ts
blob: 36f478e994d5635a940e2a9e9951332f9ab7de61 (plain)
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
import { TestBed, async } from '@angular/core/testing';
import { CheckboxComponent } from "./checkbox.component";
import { AnimationDirectivesModule } from "../../animations/animation-directives.module";
import { FormsModule } from "@angular/forms";


describe("Checbox Tests", ()=>{
    let component: CheckboxComponent;
    beforeEach(async(() => {
        TestBed.configureTestingModule({
            declarations: [
                CheckboxComponent
            ],
            imports:[
                FormsModule,
                AnimationDirectivesModule
            ]
        }).compileComponents();
        const fixture = TestBed.createComponent(CheckboxComponent);
        component = fixture.componentInstance;
    }));

    it("Component Created", async(()=> {
        expect(component).toBeDefined();
    }));

    it( "Test Value suppose to be toggled", async( ()=> {
        component.toggleState(true)
        expect(component.checked).toEqual(true);
    }));

    it( "If disabled not toggled"), async(()=>{
        component.disabled = true;
        component.toggleState(true);
        expect(component.checked).toEqual(false);
    });
});