Skip to content

Commit 2154556

Browse files
author
d-georgiev-91
committed
Fixed breaking change for issue #172 value always returns array, fixed to return a number when no multiSelection is applied and to return array when multiSelection is applied.
1 parent 37e55ed commit 2154556

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/igniteui.angular2.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2318,10 +2318,17 @@ export class IgComboComponent extends IgControlBase<IgCombo> implements ControlV
23182318
super.ngOnInit();
23192319
jQuery(this._el).on(this._widgetName.toLowerCase() + "selectionchanged", function (evt, ui) {
23202320
var items = ui.items;
2321-
if (items.length > 0 && that._model) {
2321+
2322+
if (items.length <= 0 || !that._model) {
2323+
return;
2324+
}
2325+
2326+
if (ui.owner.options.multiSelection.enabled) {
23222327
that._model.viewToModelUpdate(items.map(function(item) {
23232328
return item.data[that._config.valueKey];
23242329
}));
2330+
} else {
2331+
that._model.viewToModelUpdate(items[0].data[that._config.valueKey]);
23252332
}
23262333
});
23272334
this._dataSource = jQuery.extend(true, [], this._config.dataSource);

tests/unit/igcombo/combo.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export function main() {
8282
$("#combo1").igCombo("select", elem, {}, true);
8383
fixture.detectChanges();
8484
setTimeout(function () {
85-
expect(fixture.componentInstance.combo.value1).toEqual([1]);
85+
expect(fixture.componentInstance.combo.value1).toEqual(1);
8686
done();
8787
}, 10);
8888
});

0 commit comments

Comments
 (0)