File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed
Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ export class IgComboComponent extends IgControlBase<IgCombo> implements ControlV
3030 var items = ui . items ;
3131
3232 if ( items . length <= 0 || ! that . _model ) {
33+ that . _model . viewToModelUpdate ( ui . owner . value ( ) ) ;
3334 return ;
3435 }
3536
Original file line number Diff line number Diff line change @@ -67,6 +67,30 @@ export function main() {
6767 } ) ;
6868 } ) ;
6969
70+ it ( 'should be updated correctly if the ngModel value is cleared.' , ( done ) => {
71+ var template = '<div><ig-combo [(widgetId)]="comboID" [(options)]="options" [changeDetectionInterval]="cdi" [(ngModel)]="combo.value1"></ig-combo></div>' ;
72+ TestBed . overrideComponent ( TestComponent , {
73+ set : {
74+ template : template
75+ }
76+ } ) ;
77+ TestBed . compileComponents ( ) . then ( ( ) => {
78+ let fixture = TestBed . createComponent ( TestComponent ) ;
79+ fixture . detectChanges ( ) ;
80+ fixture . componentInstance . combo . value1 = 1 ;
81+ fixture . detectChanges ( ) ;
82+ setTimeout ( function ( ) {
83+ //clear
84+ $ ( "#combo1" ) . parents ( "ig-combo" ) . find ( ".ui-igcombo-clearicon" ) . click ( ) ;
85+ fixture . detectChanges ( ) ;
86+ setTimeout ( function ( ) {
87+ expect ( fixture . componentInstance . combo . value1 instanceof Array && fixture . componentInstance . combo . value1 . length === 0 ) . toBeTruthy ( ) ;
88+ done ( ) ;
89+ } , 10 ) ;
90+ } , 10 ) ;
91+ } ) ;
92+ } ) ;
93+
7094 it ( 'the ngModel should be updated correctly if the combo selection is updated' , ( done ) => {
7195 var template = '<div><ig-combo [(widgetId)]="comboID" [(options)]="options" [changeDetectionInterval]="cdi" [(ngModel)]="combo.value1"></ig-combo></div>' ;
7296 TestBed . overrideComponent ( TestComponent , {
You can’t perform that action at this time.
0 commit comments