@@ -82,7 +82,29 @@ export function main() {
8282 $ ( "#combo1" ) . igCombo ( "select" , elem , { } , true ) ;
8383 fixture . detectChanges ( ) ;
8484 setTimeout ( function ( ) {
85- expect ( fixture . componentInstance . combo . value1 ) . toBe ( 1 ) ;
85+ expect ( fixture . componentInstance . combo . value1 ) . toEqual ( [ 1 ] ) ;
86+ done ( ) ;
87+ } , 10 ) ;
88+ } ) ;
89+ } ) ;
90+
91+ it ( 'the ngModel should be updated correctly if the combo selection is updated and multiple items are selected' , ( done ) => {
92+ var template = '<div><ig-combo [(widgetId)]="comboID" [(options)]="optionsMultipleSelection" [changeDetectionInterval]="cdi" [(ngModel)]="combo.value1"></ig-combo></div>' ;
93+ TestBed . overrideComponent ( TestComponent , {
94+ set : {
95+ template : template
96+ }
97+ } ) ;
98+ TestBed . compileComponents ( ) . then ( ( ) => {
99+ let fixture = TestBed . createComponent ( TestComponent ) ;
100+ fixture . detectChanges ( ) ;
101+ var $firstThreeItems = $ ( ".ui-igcombo-listitem:lt(3)" ) ;
102+
103+ $ ( "#combo1" ) . igCombo ( "select" , $firstThreeItems , { } , true ) ;
104+
105+ fixture . detectChanges ( ) ;
106+ setTimeout ( function ( ) {
107+ expect ( fixture . componentInstance . combo . value1 ) . toEqual ( [ 1 , 2 , 3 ] ) ;
86108 done ( ) ;
87109 } , 10 ) ;
88110 } ) ;
@@ -142,6 +164,7 @@ export function main() {
142164} )
143165class TestComponent {
144166 private options : IgCombo ;
167+ private optionsMultipleSelection : IgCombo ;
145168 public northwind : any ;
146169 public combo : any ;
147170 private comboID : string
@@ -158,6 +181,16 @@ class TestComponent {
158181 dataSource : this . northwind ,
159182 width : "100%"
160183 } ;
184+
185+ this . optionsMultipleSelection = $ . extend ( {
186+ multiSelection : {
187+ enabled : true ,
188+ addWithKeyModifier : false ,
189+ showCheckboxes : true ,
190+ itemSeparator : ', '
191+ }
192+ } , this . options ) ;
193+
161194 this . combo = {
162195 value1 : 20
163196 }
0 commit comments