@@ -3275,12 +3275,11 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
3275
3275
3276
3276
it ( 'Should not throw error when deleting the last chip' , ( async ( ) => {
3277
3277
grid . width = '700px' ;
3278
- await wait ( 16 ) ;
3279
3278
fix . detectChanges ( ) ;
3279
+ await wait ( 16 ) ;
3280
3280
3281
3281
GridFunctions . clickFilterCellChip ( fix , 'ProductName' ) ;
3282
3282
fix . detectChanges ( ) ;
3283
- await wait ( 16 ) ;
3284
3283
3285
3284
// Add first chip.
3286
3285
GridFunctions . typeValueInFilterRowInput ( 'a' , fix ) ;
@@ -3305,7 +3304,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
3305
3304
3306
3305
verifyMultipleChipsVisibility ( fix , [ false , false , false , true ] ) ;
3307
3306
const filterUIRow = fix . debugElement . query ( By . css ( FILTER_UI_ROW ) ) ;
3308
- let chips = filterUIRow . queryAll ( By . directive ( IgxChipComponent ) ) ;
3307
+ const chips = filterUIRow . queryAll ( By . directive ( IgxChipComponent ) ) ;
3309
3308
expect ( chips . length ) . toBe ( 4 ) ;
3310
3309
3311
3310
const leftArrowButton = GridFunctions . getFilterRowLeftArrowButton ( fix ) . nativeElement ;
@@ -3315,33 +3314,61 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
3315
3314
expect ( rightArrowButton ) . toBeTruthy ( 'Right scroll arrow should be visible' ) ;
3316
3315
expect ( grid . rowList . length ) . toBe ( 2 ) ;
3317
3316
3318
- try {
3319
- GridFunctions . removeFilterChipByIndex ( 3 , filterUIRow ) ;
3320
- fix . detectChanges ( ) ;
3321
- await wait ( 400 ) ;
3322
- } catch ( ex ) {
3323
- expect ( ex ) . toBeNull ( 'Error deleting the last chip' ) ;
3324
- }
3317
+ let chipToRemove = filterUIRow . componentInstance . expressionsList [ 3 ] ;
3318
+ expect ( ( ) => { filterUIRow . componentInstance . onChipRemoved ( null , chipToRemove ) ; } )
3319
+ . not . toThrowError ( / \' i d \' o f u n d e f i n e d / ) ;
3320
+ fix . detectChanges ( ) ;
3321
+ await wait ( 500 ) ;
3322
+ fix . detectChanges ( ) ;
3323
+
3324
+ chipToRemove = filterUIRow . componentInstance . expressionsList [ 2 ] ;
3325
+ expect ( ( ) => { filterUIRow . componentInstance . onChipRemoved ( null , chipToRemove ) ; } )
3326
+ . not . toThrowError ( / \' i d \' o f u n d e f i n e d / ) ;
3325
3327
fix . detectChanges ( ) ;
3326
3328
await wait ( 100 ) ;
3329
+ } ) ) ;
3330
+
3331
+ it ( 'should scroll correct chip in view when one is deleted' , async ( ) => {
3332
+ grid . width = '700px' ;
3333
+ fix . detectChanges ( ) ;
3334
+
3335
+ GridFunctions . clickFilterCellChip ( fix , 'ProductName' ) ;
3336
+ fix . detectChanges ( ) ;
3337
+
3338
+ GridFunctions . applyFilter ( 'a' , fix ) ;
3339
+ await wait ( 16 ) ;
3340
+ GridFunctions . applyFilter ( 'e' , fix ) ;
3341
+ await wait ( 16 ) ;
3342
+ GridFunctions . applyFilter ( 'i' , fix ) ;
3343
+ await wait ( 16 ) ;
3344
+ GridFunctions . applyFilter ( 'o' , fix ) ;
3345
+ // wait for chip to be scrolled in view
3346
+ await wait ( 200 ) ;
3347
+ fix . detectChanges ( ) ;
3348
+ await wait ( 100 ) ;
3349
+ verifyMultipleChipsVisibility ( fix , [ false , false , false , true ] ) ;
3350
+
3351
+ const filterUIRow = fix . debugElement . query ( By . css ( FILTER_UI_ROW ) ) ;
3352
+ GridFunctions . removeFilterChipByIndex ( 3 , filterUIRow ) ;
3353
+ // wait for chip to be scrolled in view
3354
+ fix . detectChanges ( ) ;
3355
+ await wait ( 200 ) ;
3356
+
3327
3357
verifyMultipleChipsVisibility ( fix , [ false , true , false ] ) ;
3328
- chips = filterUIRow . queryAll ( By . directive ( IgxChipComponent ) ) ;
3358
+ let chips = filterUIRow . queryAll ( By . directive ( IgxChipComponent ) ) ;
3329
3359
expect ( chips . length ) . toBe ( 3 ) ;
3330
3360
3331
- try {
3332
- GridFunctions . removeFilterChipByIndex ( 2 , filterUIRow ) ;
3333
- fix . detectChanges ( ) ;
3334
- await wait ( 400 ) ;
3335
- } catch ( ex ) {
3336
- expect ( ex ) . toBeNull ( 'Error deleting the last chip' ) ;
3337
- }
3361
+ GridFunctions . removeFilterChipByIndex ( 2 , filterUIRow ) ;
3338
3362
fix . detectChanges ( ) ;
3339
- await wait ( 100 ) ;
3363
+ // wait for chip to be scrolled in view
3364
+ fix . detectChanges ( ) ;
3365
+ await wait ( 200 ) ;
3366
+
3340
3367
verifyMultipleChipsVisibility ( fix , [ true , false ] ) ;
3341
3368
chips = filterUIRow . queryAll ( By . directive ( IgxChipComponent ) ) ;
3342
3369
expect ( chips . length ) . toBe ( 2 ) ;
3343
3370
expect ( grid . rowList . length ) . toBe ( 3 ) ;
3344
- } ) ) ;
3371
+ } ) ;
3345
3372
3346
3373
it ( 'Should close filter row when hide the current column' , ( async ( ) => {
3347
3374
grid . height = '700px' ;
0 commit comments