@@ -2144,6 +2144,63 @@ describe('IgxGrid - Advanced Filtering #grid - ', () => {
2144
2144
expect ( GridFunctions . getAdvancedFilteringTreeChildItems ( secondItem , false ) . length ) . toBe ( 1 ) ;
2145
2145
} ) ) ;
2146
2146
2147
+ it ( 'Should respect the changes of the groups applied from the context menu.' ,
2148
+ fakeAsync ( ( ) => {
2149
+ // Apply advanced filter through API.
2150
+ const tree = new FilteringExpressionsTree ( FilteringLogic . And ) ;
2151
+ tree . filteringOperands . push ( {
2152
+ fieldName : 'ProductName' , searchVal : 'angular' , condition : IgxStringFilteringOperand . instance ( ) . condition ( 'contains' ) ,
2153
+ ignoreCase : true
2154
+ } ) ;
2155
+ tree . filteringOperands . push ( {
2156
+ fieldName : 'ProductName' , searchVal : 'script' , condition : IgxStringFilteringOperand . instance ( ) . condition ( 'contains' ) ,
2157
+ ignoreCase : true
2158
+ } ) ;
2159
+ grid . advancedFilteringExpressionsTree = tree ;
2160
+ fix . detectChanges ( ) ;
2161
+
2162
+ // Verify the filter changes are applied.
2163
+ expect ( grid . filteredData . length ) . toEqual ( 0 ) ;
2164
+
2165
+ // Open Advanced Filtering dialog.
2166
+ grid . openAdvancedFilteringDialog ( ) ;
2167
+ fix . detectChanges ( ) ;
2168
+
2169
+ // Verify tree layout before the group change through context menu.
2170
+ let rootGroup = GridFunctions . getAdvancedFilteringTreeRootGroup ( fix ) ;
2171
+ expect ( GridFunctions . getAdvancedFilteringTreeChildItems ( rootGroup , true ) . length ) . toBe ( 2 ) ;
2172
+ expect ( GridFunctions . getAdvancedFilteringTreeChildItems ( rootGroup , false ) . length ) . toBe ( 2 ) ;
2173
+
2174
+ // Select two chips.
2175
+ GridFunctions . clickAdvancedFilteringTreeExpressionChip ( fix , [ 0 ] ) ;
2176
+ GridFunctions . clickAdvancedFilteringTreeExpressionChip ( fix , [ 1 ] ) ;
2177
+ tick ( 200 ) ;
2178
+
2179
+ // Click "Create Or Group" in context menu.
2180
+ const buttons = GridFunctions . getAdvancedFilteringContextMenuButtons ( fix ) ;
2181
+ buttons [ 2 ] . click ( ) ;
2182
+ tick ( 100 ) ;
2183
+ fix . detectChanges ( ) ;
2184
+
2185
+ // Close dialog through API.
2186
+ grid . closeAdvancedFilteringDialog ( true ) ;
2187
+ tick ( 100 ) ;
2188
+ fix . detectChanges ( ) ;
2189
+
2190
+ // Open Advanced Filtering dialog.
2191
+ grid . openAdvancedFilteringDialog ( ) ;
2192
+ fix . detectChanges ( ) ;
2193
+
2194
+ // Verify tree layout after the group change through context menu.
2195
+ rootGroup = GridFunctions . getAdvancedFilteringTreeRootGroup ( fix ) ;
2196
+ expect ( GridFunctions . getAdvancedFilteringTreeChildItems ( rootGroup , true ) . length ) . toBe ( 1 ) ;
2197
+ expect ( GridFunctions . getAdvancedFilteringTreeChildItems ( rootGroup , false ) . length ) . toBe ( 3 ) ;
2198
+
2199
+ // Verify the filter changes are applied.
2200
+ expect ( grid . filteredData . length ) . toEqual ( 3 ) ;
2201
+ } ) ) ;
2202
+
2203
+
2147
2204
it ( 'Should delete all selected conditions when the \'delete filters\' option from context menu is clicked.' ,
2148
2205
fakeAsync ( ( ) => {
2149
2206
// Apply advanced filter through API.
0 commit comments