Skip to content

Commit 20b6dfc

Browse files
committed
Merge remote-tracking branch 'remotes/origin/10.0.x' into AMarinov/stringEnumsChange_10
2 parents 712c349 + a47c244 commit 20b6dfc

File tree

8 files changed

+412
-226
lines changed

8 files changed

+412
-226
lines changed

projects/igniteui-angular/src/lib/combo/combo.component.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@
4545
<div #dropdownItemContainer class="igx-combo__content" [style.overflow]="'hidden'"
4646
[style.maxHeight.px]="itemsMaxHeight" [igxDropDownItemNavigation]="dropdown" (focus)="dropdown.onFocus()"
4747
[tabindex]="dropdown.collapsed ? -1 : 0" role="listbox" [attr.id]="dropdown.id">
48-
<igx-combo-item role="option" [itemHeight]='itemHeight'
49-
*igxFor="let item of data
50-
| comboFiltering:searchValue:displayKey:filterable
48+
<igx-combo-item role="option" [itemHeight]='itemHeight' *igxFor="let item of data
49+
| comboFiltering:filterValue:displayKey:filterable
5150
| comboGrouping:groupKey:valueKey;
5251
index as rowIndex; containerSize: itemsMaxHeight; scrollOrientation: 'vertical'; itemSize: itemHeight"
5352
[value]="item" [isHeader]="item.isHeader" [index]="rowIndex">

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { async, TestBed, tick, fakeAsync } from '@angular/core/testing';
33
import { By } from '@angular/platform-browser';
44
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
55
import { FormGroup, FormControl, Validators, FormBuilder, ReactiveFormsModule, FormsModule, NgControl } from '@angular/forms';
6-
import { IgxComboComponent, IgxComboModule, IComboSelectionChangeEventArgs, IgxComboState } from './combo.component';
6+
import { IgxComboComponent, IgxComboModule, IComboSelectionChangeEventArgs, IgxComboState, IComboSearchInputEventArgs } from './combo.component';
77
import { IgxComboItemComponent } from './combo-item.component';
88
import { IgxComboDropDownComponent } from './combo-dropdown.component';
99
import { IgxComboAddItemComponent } from './combo-add-item.component';
@@ -565,7 +565,7 @@ describe('igxCombo', () => {
565565

566566
combo.handleInputChange('Item1');
567567
expect(combo.onSearchInput.emit).toHaveBeenCalledTimes(1);
568-
expect(matchSpy).toHaveBeenCalledTimes(0);
568+
expect(matchSpy).toHaveBeenCalledTimes(1);
569569
});
570570
});
571571
describe('Initialization and rendering tests: ', () => {
@@ -2377,6 +2377,17 @@ describe('igxCombo', () => {
23772377
fixture.detectChanges();
23782378
expect(combo.isAddButtonVisible()).toEqual(true);
23792379
});
2380+
it('Should NOT filter the data when onSearchInput is canceled', () => {
2381+
const cancelSub = combo.onSearchInput.subscribe((event: IComboSearchInputEventArgs) => event.cancel = true);
2382+
combo.toggle();
2383+
fixture.detectChanges();
2384+
const searchInput = fixture.debugElement.query(By.css('input[name=\'searchInput\']'));
2385+
UIInteractions.triggerInputEvent(searchInput, 'Test');
2386+
fixture.detectChanges();
2387+
expect(combo.filteredData.length).toEqual(combo.data.length);
2388+
expect(combo.searchValue).toEqual('Test');
2389+
cancelSub.unsubscribe();
2390+
});
23802391
});
23812392
describe('Form control tests: ', () => {
23822393
describe('Reactive form tests: ', () => {

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,15 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
145145
* @hidden @internal
146146
*/
147147
public defaultFallbackGroup = 'Other';
148+
/** @hidden @internal */
149+
public filterValue = '';
148150
protected stringFilters = IgxStringFilteringOperand;
149151
protected booleanFilters = IgxBooleanFilteringOperand;
150152
protected _groupKey = '';
151153
protected _displayKey: string;
152154
protected _prevInputValue = '';
153155
private _dataType = '';
156+
private _searchValue = '';
154157
private ngControl: NgControl = null;
155158
private destroy$ = new Subject<any>();
156159
private _data = [];
@@ -855,7 +858,14 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
855858
/**
856859
* @hidden @internal
857860
*/
858-
public searchValue = '';
861+
public get searchValue(): string {
862+
return this._searchValue;
863+
}
864+
865+
public set searchValue(val: string) {
866+
this.filterValue = val;
867+
this._searchValue = val;
868+
}
859869

860870
/**
861871
* @hidden @internal
@@ -997,8 +1007,7 @@ export class IgxComboComponent extends DisplayDensityBase implements IgxComboBas
9971007
};
9981008
this.onSearchInput.emit(args);
9991009
if (args.cancel) {
1000-
this.searchValue = null;
1001-
return;
1010+
this.filterValue = null;
10021011
}
10031012
}
10041013
this.checkMatch();

projects/igniteui-angular/src/lib/date-picker/date-picker.component.spec.ts

Lines changed: 186 additions & 92 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)