Skip to content

Commit df19018

Browse files
committed
Adding test for issue #204
Adding test for issue #204
1 parent d200cd7 commit df19018

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/unit/igcombo/combo.spec.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,25 @@ export function main() {
6666
}, 10);
6767
});
6868
});
69+
it('should be updated correctly if the ngModel value is cleared.', (done) => {
70+
var template = '<div><ig-combo [(widgetId)]="comboID" [(options)]="options" [changeDetectionInterval]="cdi" [(ngModel)]="combo.value1"></ig-combo></div>';
71+
TestBed.overrideComponent(TestComponent, {
72+
set: {
73+
template: template
74+
}
75+
});
76+
TestBed.compileComponents().then(() => {
77+
let fixture = TestBed.createComponent(TestComponent);
78+
fixture.detectChanges();
79+
//clear
80+
$("#combo1").find(".ui-igcombo-clearicon").click();
81+
fixture.detectChanges();
82+
setTimeout(function () {
83+
expect(fixture.componentInstance.combo.value1 instanceof Array && fixture.componentInstance.combo.value1.length === 0).toBeTruthy();
84+
done();
85+
}, 10);
86+
});
87+
});
6988

7089
it('the ngModel should be updated correctly if the combo selection is updated', (done) => {
7190
var template = '<div><ig-combo [(widgetId)]="comboID" [(options)]="options" [changeDetectionInterval]="cdi" [(ngModel)]="combo.value1"></ig-combo></div>';

0 commit comments

Comments
 (0)