aboutsummaryrefslogtreecommitdiffstats
path: root/src/angular/form-elements/checkbox/checkbox.component.spec.ts
blob: 8fc63e2459b7948df94eaae914aaca79a6701bff (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
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);
    });
});