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