@@ -3,7 +3,7 @@ import { async, TestBed, tick, fakeAsync } from '@angular/core/testing';
33import { By } from '@angular/platform-browser' ;
44import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
55import { 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' ;
77import { IgxComboItemComponent } from './combo-item.component' ;
88import { IgxComboDropDownComponent } from './combo-dropdown.component' ;
99import { IgxComboAddItemComponent } from './combo-add-item.component' ;
@@ -586,7 +586,7 @@ describe('igxCombo', () => {
586586
587587 combo . handleInputChange ( 'Item1' ) ;
588588 expect ( combo . onSearchInput . emit ) . toHaveBeenCalledTimes ( 1 ) ;
589- expect ( matchSpy ) . toHaveBeenCalledTimes ( 0 ) ;
589+ expect ( matchSpy ) . toHaveBeenCalledTimes ( 1 ) ;
590590 } ) ;
591591 } ) ;
592592 describe ( 'Initialization and rendering tests: ' , ( ) => {
@@ -2432,6 +2432,17 @@ describe('igxCombo', () => {
24322432 fixture . detectChanges ( ) ;
24332433 expect ( [ ...combo . filteredData ] ) . toEqual ( combo . data . filter ( e => e [ 'field' ] . includes ( 'M' ) ) ) ;
24342434 } ) ;
2435+ it ( 'Should NOT filter the data when onSearchInput is canceled' , ( ) => {
2436+ const cancelSub = combo . onSearchInput . subscribe ( ( event : IComboSearchInputEventArgs ) => event . cancel = true ) ;
2437+ combo . toggle ( ) ;
2438+ fixture . detectChanges ( ) ;
2439+ const searchInput = fixture . debugElement . query ( By . css ( 'input[name=\'searchInput\']' ) ) ;
2440+ UIInteractions . triggerInputEvent ( searchInput , 'Test' ) ;
2441+ fixture . detectChanges ( ) ;
2442+ expect ( combo . filteredData . length ) . toEqual ( combo . data . length ) ;
2443+ expect ( combo . searchValue ) . toEqual ( 'Test' ) ;
2444+ cancelSub . unsubscribe ( ) ;
2445+ } ) ;
24352446 } ) ;
24362447 describe ( 'Form control tests: ' , ( ) => {
24372448 describe ( 'Reactive form tests: ' , ( ) => {
0 commit comments