aboutsummaryrefslogtreecommitdiffstats
path: root/src/angular/form-elements/radios/radio-buttons-group.component.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/angular/form-elements/radios/radio-buttons-group.component.spec.ts')
-rw-r--r--src/angular/form-elements/radios/radio-buttons-group.component.spec.ts52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/angular/form-elements/radios/radio-buttons-group.component.spec.ts b/src/angular/form-elements/radios/radio-buttons-group.component.spec.ts
new file mode 100644
index 0000000..273a701
--- /dev/null
+++ b/src/angular/form-elements/radios/radio-buttons-group.component.spec.ts
@@ -0,0 +1,52 @@
+import { TestBed, async } from '@angular/core/testing';
+import { RadioGroupComponent } from "./radio-buttons-group.component";
+import { FormsModule } from "@angular/forms";
+import { IRadioButtonModel } from "./radio-button.model";
+import { AnimationDirectivesModule } from "../../animations/animation-directives.module";
+
+
+describe("Radio Buttons unit-tests", ()=>{
+ let component: RadioGroupComponent;
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [
+ RadioGroupComponent
+ ],
+ imports:[
+ FormsModule,
+ AnimationDirectivesModule
+ ]
+ }).compileComponents();
+
+ const fixture = TestBed.createComponent(RadioGroupComponent);
+ component = fixture.componentInstance;
+ component.disabled = false;//TODO constructor
+ component.options = {
+ items: []
+ };
+ }));
+
+ it('Component Created', async(()=> {
+ expect(component).toBeDefined();
+ }));
+
+ it('Not possible to choose value which not exists', async(() =>{
+ component.value = 'test';
+ expect(component.value).not.toEqual('test');
+ }));
+
+ it('Normal flow', async(() =>{
+ component.options.items = [ <IRadioButtonModel> {
+ value: 'val1',
+ name: 'exp6',
+ label: 'Label of Radio1'
+ }, <IRadioButtonModel> {
+ value: 'val2',
+ name: 'exp6',
+ label: 'Label of Radio2'
+ }];
+ component.value = component.options.items[0].value;
+ expect(component.value).toEqual(component.options.items[0].value);
+ }));
+
+});