@@ -1918,6 +1918,51 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => {
19181918 verifyChildrenSelection ( GridFunctions . getAdvancedFilteringTreeItem ( fix , [ 1 ] ) , false ) ;
19191919 } ) ) ;
19201920
1921+ it ( 'Should remove all empty groups when clicking `delete` on a group\'s operator line\'s context menu.' , fakeAsync ( ( ) => {
1922+ // Apply advanced filter through API.
1923+ const rootTree = new FilteringExpressionsTree ( FilteringLogic . And ) ;
1924+ rootTree . filteringOperands . push ( {
1925+ fieldName : 'Downloads' , searchVal : 100 , condition : IgxNumberFilteringOperand . instance ( ) . condition ( 'greaterThan' )
1926+ } ) ;
1927+ const firstTree = new FilteringExpressionsTree ( FilteringLogic . And ) ;
1928+ const secondTree = new FilteringExpressionsTree ( FilteringLogic . Or ) ;
1929+ const thirdTree = new FilteringExpressionsTree ( FilteringLogic . And ) ;
1930+ thirdTree . filteringOperands . push ( {
1931+ fieldName : 'ProductName' , searchVal : 'a' , condition : IgxStringFilteringOperand . instance ( ) . condition ( 'contains' ) ,
1932+ ignoreCase : true
1933+ } ) ;
1934+ thirdTree . filteringOperands . push ( {
1935+ fieldName : 'ProductName' , searchVal : 's' , condition : IgxStringFilteringOperand . instance ( ) . condition ( 'contains' ) ,
1936+ ignoreCase : true
1937+ } ) ;
1938+ secondTree . filteringOperands . push ( thirdTree ) ;
1939+ firstTree . filteringOperands . push ( secondTree ) ;
1940+ rootTree . filteringOperands . push ( firstTree ) ;
1941+ grid . advancedFilteringExpressionsTree = rootTree ;
1942+ fix . detectChanges ( ) ;
1943+
1944+ // Open Advanced Filtering dialog.
1945+ grid . openAdvancedFilteringDialog ( ) ;
1946+ fix . detectChanges ( ) ;
1947+
1948+ // Click group's outer operator line.
1949+ let middleGroupOperatorLine = GridFunctions . getAdvancedFilteringTreeGroupOperatorLine ( fix , [ 1 ] ) ;
1950+ middleGroupOperatorLine . click ( ) ;
1951+ tick ( 200 ) ;
1952+ fix . detectChanges ( ) ;
1953+
1954+ // Click on `delete` in the context menu.
1955+ let deleteBtn = fix . nativeElement . querySelector ( '.igx-filter-contextual-menu__delete-btn' ) ;
1956+ deleteBtn . click ( ) ;
1957+ tick ( 200 ) ;
1958+ fix . detectChanges ( ) ;
1959+
1960+ // Verify tree layout and remaining chip content
1961+ let rootGroup = GridFunctions . getAdvancedFilteringTreeRootGroup ( fix ) ;
1962+ expect ( GridFunctions . getAdvancedFilteringTreeChildItems ( rootGroup , true ) . length ) . toBe ( 1 ) ;
1963+ verifyExpressionChipContent ( fix , [ 0 ] , 'Downloads' , 'Greater Than' , '100' ) ;
1964+ } ) ) ;
1965+
19211966 it ( 'Should open the operator dropdown below its respective input-group.' , fakeAsync ( ( ) => {
19221967 // Open Advanced Filtering dialog.
19231968 grid . openAdvancedFilteringDialog ( ) ;
0 commit comments