@@ -3275,12 +3275,11 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
32753275
32763276 it ( 'Should not throw error when deleting the last chip' , ( async ( ) => {
32773277 grid . width = '700px' ;
3278- await wait ( 16 ) ;
32793278 fix . detectChanges ( ) ;
3279+ await wait ( 16 ) ;
32803280
32813281 GridFunctions . clickFilterCellChip ( fix , 'ProductName' ) ;
32823282 fix . detectChanges ( ) ;
3283- await wait ( 16 ) ;
32843283
32853284 // Add first chip.
32863285 GridFunctions . typeValueInFilterRowInput ( 'a' , fix ) ;
@@ -3305,7 +3304,7 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
33053304
33063305 verifyMultipleChipsVisibility ( fix , [ false , false , false , true ] ) ;
33073306 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 ) ) ;
33093308 expect ( chips . length ) . toBe ( 4 ) ;
33103309
33113310 const leftArrowButton = GridFunctions . getFilterRowLeftArrowButton ( fix ) . nativeElement ;
@@ -3315,33 +3314,61 @@ describe('IgxGrid - Filtering Row UI actions #grid', () => {
33153314 expect ( rightArrowButton ) . toBeTruthy ( 'Right scroll arrow should be visible' ) ;
33163315 expect ( grid . rowList . length ) . toBe ( 2 ) ;
33173316
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 / ) ;
33253327 fix . detectChanges ( ) ;
33263328 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+
33273357 verifyMultipleChipsVisibility ( fix , [ false , true , false ] ) ;
3328- chips = filterUIRow . queryAll ( By . directive ( IgxChipComponent ) ) ;
3358+ let chips = filterUIRow . queryAll ( By . directive ( IgxChipComponent ) ) ;
33293359 expect ( chips . length ) . toBe ( 3 ) ;
33303360
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 ) ;
33383362 fix . detectChanges ( ) ;
3339- await wait ( 100 ) ;
3363+ // wait for chip to be scrolled in view
3364+ fix . detectChanges ( ) ;
3365+ await wait ( 200 ) ;
3366+
33403367 verifyMultipleChipsVisibility ( fix , [ true , false ] ) ;
33413368 chips = filterUIRow . queryAll ( By . directive ( IgxChipComponent ) ) ;
33423369 expect ( chips . length ) . toBe ( 2 ) ;
33433370 expect ( grid . rowList . length ) . toBe ( 3 ) ;
3344- } ) ) ;
3371+ } ) ;
33453372
33463373 it ( 'Should close filter row when hide the current column' , ( async ( ) => {
33473374 grid . height = '700px' ;
0 commit comments