summaryrefslogtreecommitdiffstats
path: root/src/angular/form-elements/dropdown/dropdown.component.spec.ts
diff options
context:
space:
mode:
authorIsrael Lavi <israel.lavi@intl.att.com>2018-05-21 17:42:00 +0300
committerIsrael Lavi <il0695@att.com>2018-05-21 17:52:01 +0300
commit1994c98063c27a41797dec01f2ca9fcbe33ceab0 (patch)
treef30beeaf15a8358f6da78fdd74bcbda74bd334f8 /src/angular/form-elements/dropdown/dropdown.component.spec.ts
parent4749f4631426fcbe29ed98cef8f24cab18b501d0 (diff)
init commit onap ui
Change-Id: I1dace78817dbba752c550c182dfea118b4a38646 Issue-ID: SDC-1350 Signed-off-by: Israel Lavi <il0695@att.com>
Diffstat (limited to 'src/angular/form-elements/dropdown/dropdown.component.spec.ts')
-rw-r--r--src/angular/form-elements/dropdown/dropdown.component.spec.ts71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/angular/form-elements/dropdown/dropdown.component.spec.ts b/src/angular/form-elements/dropdown/dropdown.component.spec.ts
new file mode 100644
index 0000000..1c0cb4d
--- /dev/null
+++ b/src/angular/form-elements/dropdown/dropdown.component.spec.ts
@@ -0,0 +1,71 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { DropDownComponent } from './dropdown.component';
+import { IDropDownOption, DropDownTypes } from "./dropdown-models";
+import { FormsModule } from "@angular/forms";
+import {SvgIconModule} from "../../svg-icon/svg-icon.module";
+
+
+const label:string = "DropDown example";
+const placeHolder:string = "Please choose option";
+const options:IDropDownOption[] = [
+ {
+ label:'First Option',
+ value: 'First Option'
+ },
+ {
+ label:'Second Option',
+ value: 'Second Option'
+ },
+ {
+ label:'Third Option',
+ value: 'Third Option'
+ }
+];
+
+describe('DropDown component', () => {
+ let fixture: ComponentFixture<DropDownComponent>;
+ let component: DropDownComponent;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ DropDownComponent ],
+ imports:[
+ FormsModule,
+ SvgIconModule
+ ]
+ }).compileComponents();
+ fixture = TestBed.createComponent(DropDownComponent);
+ component = fixture.componentInstance;
+
+ }));
+
+ beforeEach(()=>{
+ component.label = label;
+ component.placeHolder = placeHolder;
+ component.options = options;
+ component.type = DropDownTypes.Regular;
+ console.log('herer we got component', component)
+ fixture.detectChanges();
+ });
+
+ it('component should be created', () => {
+ expect(component).toBeTruthy();
+ });
+
+ it('component should export the selected value', () => {
+ const option = options[1];
+ component.selectOption(option);
+ fixture.detectChanges();
+ expect(component.selectedOption).toEqual(option);
+ });
+
+ it('component should have autocomplite', () => {
+ expect(component.options.length).toEqual(3);
+ component.type = DropDownTypes.Auto;
+ component.filterValue = 'testERrorotesttresadfadfasdfasf';
+ fixture.detectChanges();
+ component.filterOptions(component.filterValue);
+ expect(component.options.length).toEqual(0);
+ });
+
+});