@@ -20,6 +20,7 @@ import { resizeObserverIgnoreError } from '../../test-utils/helper-utils.spec';
20
20
const ADVANCED_FILTERING_OPERATOR_LINE_AND_CSS_CLASS = 'igx-filter-tree__line--and' ;
21
21
const ADVANCED_FILTERING_OPERATOR_LINE_OR_CSS_CLASS = 'igx-filter-tree__line--or' ;
22
22
const ADVANCED_FILTERING_OPERATOR_LINE_SELECTED_CSS_CLASS = 'igx-filter-tree__line--selected' ;
23
+ const ADVANCED_FILTERING_TOOLBAR_ICON_BUTTON_FILTERED_CSS_CLASS = 'igx-grid-toolbar__adv-filter--filtered' ;
23
24
24
25
describe ( 'IgxGrid - Advanced Filtering' , ( ) => {
25
26
configureTestSuite ( ) ;
@@ -324,6 +325,58 @@ describe('IgxGrid - Advanced Filtering', () => {
324
325
expect ( GridFunctions . getCurrentCellFromGrid ( grid , 1 , 1 ) . value ) . toBe ( 'Ignite UI for Angular' ) ;
325
326
} ) ) ;
326
327
328
+ it ( 'Should update the Advanced Filtering button icon in toolbar when (filtering)/(clear filtering).' ,
329
+ fakeAsync ( ( ) => {
330
+ // Verify that the advanced filtering button icon indicates there are no filters.
331
+ let advFilterIcon = GridFunctions . getAdvancedFilteringButton ( fix ) . querySelector ( 'igx-icon' ) ;
332
+ expect ( advFilterIcon . classList . contains ( ADVANCED_FILTERING_TOOLBAR_ICON_BUTTON_FILTERED_CSS_CLASS ) )
333
+ . toBe ( false , 'Button icon indicates there is active filtering.' ) ;
334
+
335
+ // Open Advanced Filtering dialog.
336
+ GridFunctions . clickAdvancedFilteringButton ( fix ) ;
337
+ fix . detectChanges ( ) ;
338
+
339
+ // Click the initial 'Add And Group' button.
340
+ const addAndGroupButton = GridFunctions . getAdvancedFilteringInitialAddGroupButtons ( fix ) [ 0 ] ;
341
+ addAndGroupButton . click ( ) ;
342
+ tick ( 100 ) ;
343
+ fix . detectChanges ( ) ;
344
+
345
+ // Populate edit inputs.
346
+ selectColumnInEditModeExpression ( fix , 1 ) ; // Select 'ProductName' column.
347
+ selectOperatorInEditModeExpression ( fix , 0 ) ; // Select 'Contains' operator.
348
+ const input = GridFunctions . getAdvancedFilteringValueInput ( fix ) . querySelector ( 'input' ) ;
349
+ sendInputNativeElement ( fix , input , 'angular' ) ; // Type filter value.
350
+ // Commit the populated expression.
351
+ GridFunctions . clickAdvancedFilteringExpressionCommitButton ( fix ) ;
352
+ fix . detectChanges ( ) ;
353
+
354
+ // Apply the filters.
355
+ GridFunctions . clickAdvancedFilteringApplyButton ( fix ) ;
356
+
357
+ // Verify that the advanced filtering button icon indicates there are filters.
358
+ advFilterIcon = GridFunctions . getAdvancedFilteringButton ( fix ) . querySelector ( 'igx-icon' ) ;
359
+ expect ( advFilterIcon . classList . contains ( ADVANCED_FILTERING_TOOLBAR_ICON_BUTTON_FILTERED_CSS_CLASS ) )
360
+ . toBe ( true , 'Button icon indicates there is no active filtering.' ) ;
361
+
362
+ // Open Advanced Filtering dialog.
363
+ GridFunctions . clickAdvancedFilteringButton ( fix ) ;
364
+ fix . detectChanges ( ) ;
365
+
366
+ // Clear the filters.
367
+ GridFunctions . clickAdvancedFilteringClearFilterButton ( fix ) ;
368
+ fix . detectChanges ( ) ;
369
+
370
+ // Close the dialog.
371
+ GridFunctions . clickAdvancedFilteringApplyButton ( fix ) ;
372
+ fix . detectChanges ( ) ;
373
+
374
+ // Verify that the advanced filtering button icon indicates there are no filters.
375
+ advFilterIcon = GridFunctions . getAdvancedFilteringButton ( fix ) . querySelector ( 'igx-icon' ) ;
376
+ expect ( advFilterIcon . classList . contains ( ADVANCED_FILTERING_TOOLBAR_ICON_BUTTON_FILTERED_CSS_CLASS ) )
377
+ . toBe ( false , 'Button icon indicates there is active filtering.' ) ;
378
+ } ) ) ;
379
+
327
380
it ( 'Should correctly filter by a \'string\' column through UI.' , fakeAsync ( ( ) => {
328
381
// Test prerequisites
329
382
grid . height = '800px' ;
0 commit comments