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