@@ -3246,6 +3246,69 @@ describe('IgxGrid - Filtering Row UI actions', () => {
32463246 const chipDiv = GridFunctions . getFilterConditionChip ( fix , 0 ) . querySelector ( '.igx-chip__item' ) ;
32473247 expect ( chipDiv . classList . contains ( 'igx-chip__item--selected' ) ) . toBe ( true , 'chip is not selected' ) ;
32483248 } ) ) ;
3249+
3250+ it ( 'Should not throw error when deleting the last chip' , ( async ( ) => {
3251+ grid . width = '700px' ;
3252+ fix . detectChanges ( ) ;
3253+ await wait ( 100 ) ;
3254+
3255+ GridFunctions . clickFilterCellChip ( fix , 'ProductName' ) ;
3256+ fix . detectChanges ( ) ;
3257+
3258+ // Add first chip.
3259+ GridFunctions . typeValueInFilterRowInput ( 'a' , fix ) ;
3260+ await wait ( 16 ) ;
3261+ GridFunctions . submitFilterRowInput ( fix ) ;
3262+ await wait ( 100 ) ;
3263+ // Add second chip.
3264+ GridFunctions . typeValueInFilterRowInput ( 'e' , fix ) ;
3265+ await wait ( 16 ) ;
3266+ GridFunctions . submitFilterRowInput ( fix ) ;
3267+ await wait ( 100 ) ;
3268+ // Add third chip.
3269+ GridFunctions . typeValueInFilterRowInput ( 'i' , fix ) ;
3270+ await wait ( 16 ) ;
3271+ GridFunctions . submitFilterRowInput ( fix ) ;
3272+ await wait ( 100 ) ;
3273+ // Add fourth chip.
3274+ GridFunctions . typeValueInFilterRowInput ( 'o' , fix ) ;
3275+ await wait ( 16 ) ;
3276+ GridFunctions . submitFilterRowInput ( fix ) ;
3277+ await wait ( 200 ) ;
3278+
3279+ verifyMultipleChipsVisibility ( fix , [ false , false , false , true ] ) ;
3280+ const filterUIRow = fix . debugElement . query ( By . css ( FILTER_UI_ROW ) ) ;
3281+ let chips = filterUIRow . queryAll ( By . directive ( IgxChipComponent ) ) ;
3282+ expect ( chips . length ) . toBe ( 4 ) ;
3283+
3284+ const leftArrowButton = GridFunctions . getFilterRowLeftArrowButton ( fix ) . nativeElement ;
3285+ expect ( leftArrowButton ) . toBeTruthy ( 'Left scroll arrow should be visible' ) ;
3286+
3287+ const rightArrowButton = GridFunctions . getFilterRowRightArrowButton ( fix ) . nativeElement ;
3288+ expect ( rightArrowButton ) . toBeTruthy ( 'Right scroll arrow should be visible' ) ;
3289+ expect ( grid . rowList . length ) . toBe ( 2 ) ;
3290+
3291+ let chipToRemove = filterUIRow . componentInstance . expressionsList [ 3 ] ;
3292+ expect ( ( ) => { filterUIRow . componentInstance . onChipRemoved ( null , chipToRemove ) ; } )
3293+ . not . toThrowError ( / \' i d \' o f u n d e f i n e d / ) ;
3294+ await wait ( 200 ) ;
3295+ fix . detectChanges ( ) ;
3296+
3297+ verifyMultipleChipsVisibility ( fix , [ false , true , false ] ) ;
3298+ chips = filterUIRow . queryAll ( By . directive ( IgxChipComponent ) ) ;
3299+ expect ( chips . length ) . toBe ( 3 ) ;
3300+
3301+ chipToRemove = filterUIRow . componentInstance . expressionsList [ 2 ] ;
3302+ expect ( ( ) => { filterUIRow . componentInstance . onChipRemoved ( null , chipToRemove ) ; } )
3303+ . not . toThrowError ( / \' i d \' o f u n d e f i n e d / ) ;
3304+ await wait ( 200 ) ;
3305+ fix . detectChanges ( ) ;
3306+
3307+ verifyMultipleChipsVisibility ( fix , [ true , false ] ) ;
3308+ chips = filterUIRow . queryAll ( By . directive ( IgxChipComponent ) ) ;
3309+ expect ( chips . length ) . toBe ( 2 ) ;
3310+ expect ( grid . rowList . length ) . toBe ( 3 ) ;
3311+ } ) ) ;
32493312 } ) ;
32503313
32513314 describe ( null , ( ) => {
0 commit comments