Skip to content

Commit 3e527e5

Browse files
authored
Merge pull request #13510 from IgniteUI/rivanova/fix-13220-15.1.x
fix(simple-combo): clear input on blur when bound to remote data - 15.1.x
2 parents 8c15359 + 1687cec commit 3e527e5

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,6 +2054,18 @@ describe('IgxSimpleCombo', () => {
20542054
const selectedItem = combo.data[combo.data.length - 1];
20552055
expect(combo.value).toEqual(`${selectedItem[combo.displayKey]}`);
20562056
}));
2057+
it('should clear input on blur when bound to remote data and no item is selected', () => {
2058+
input.triggerEventHandler('focus', {});
2059+
fixture.detectChanges();
2060+
2061+
UIInteractions.simulateTyping('pro', input);
2062+
fixture.detectChanges();
2063+
2064+
UIInteractions.triggerEventHandlerKeyDown('Tab', input);
2065+
fixture.detectChanges();
2066+
2067+
expect(combo.comboInput.value).toEqual('');
2068+
});
20572069
});
20582070
});
20592071

projects/igniteui-angular/src/lib/simple-combo/simple-combo.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,8 @@ export class IgxSimpleComboComponent extends IgxComboBaseDirective implements Co
529529
private clearOnBlur(): void {
530530
if (this.isRemote) {
531531
const searchValue = this.searchValue || this.comboInput.value;
532-
const remoteValue = Object.keys(this._remoteSelection).map(e => this._remoteSelection[e])[0];
533-
if (remoteValue && searchValue !== remoteValue) {
532+
const remoteValue = Object.keys(this._remoteSelection).map(e => this._remoteSelection[e])[0] || '';
533+
if (searchValue !== remoteValue) {
534534
this.clear();
535535
}
536536
return;

0 commit comments

Comments
 (0)