@@ -20,7 +20,7 @@ import {
2020import { NoopAnimationsModule } from '@angular/platform-browser/animations' ;
2121import { UIInteractions , wait } from '../../../test-utils/ui-interactions.spec' ;
2222import { GridFunctions , GridSummaryFunctions } from '../../../test-utils/grid-functions.spec' ;
23- import { IgxCellFooterTemplateDirective , IgxCellHeaderTemplateDirective , IgxCellTemplateDirective , IgxColumnComponent , IgxSummaryTemplateDirective } from 'igniteui-angular/grids/core' ;
23+ import { IgxCellFooterTemplateDirective , IgxCellHeaderTemplateDirective , IgxCellTemplateDirective , IgxColumnComponent , INPUT_DEBOUNCE_TIME_DEFAULT , IgxSummaryTemplateDirective } from 'igniteui-angular/grids/core' ;
2424import { IgxGridRowComponent } from './grid-row.component' ;
2525import { GridColumnDataType , IgxStringFilteringOperand , SortingDirection } from 'igniteui-angular/core' ;
2626import { IgxButtonDirective , IgxDateTimeEditorDirective } from 'igniteui-angular/directives' ;
@@ -838,6 +838,77 @@ describe('IgxGrid - Column properties #grid', () => {
838838 expect ( ( checkBoxes [ 3 ] . querySelector ( '.igx-checkbox__label' ) as HTMLElement ) . innerText ) . toEqual ( '002.700%' ) ;
839839 } ) ) ;
840840
841+ it ( 'should show percent suffix in filter row when filtering a percent column' , fakeAsync ( ( ) => {
842+ const fix = TestBed . createComponent ( IgxGridPercentColumnComponent ) ;
843+ fix . detectChanges ( ) ;
844+
845+ const grid = fix . componentInstance . grid ;
846+ const discountColumn = grid . getColumnByName ( 'Discount' ) ;
847+ grid . allowFiltering = true ;
848+ fix . detectChanges ( ) ;
849+
850+ GridFunctions . clickFilterCellChip ( fix , discountColumn . field ) ;
851+ tick ( 100 ) ;
852+ fix . detectChanges ( ) ;
853+
854+ const filterUIRow = fix . debugElement . query ( By . css ( 'igx-grid-filtering-row' ) ) ;
855+ const input = filterUIRow . query ( By . directive ( IgxInputDirective ) ) ;
856+
857+ // Suffix should not be visible before entering a value
858+ let percentLabel = filterUIRow . query ( By . css ( '.igx-grid__filtering-row-percent-hint' ) ) ;
859+ expect ( percentLabel ) . toBeNull ( ) ;
860+
861+ // Enter a value to trigger the suffix; wait for the filter row input debounce
862+ GridFunctions . typeValueInFilterRowInput ( 0.03 , fix , input ) ;
863+ tick ( INPUT_DEBOUNCE_TIME_DEFAULT ) ;
864+ fix . detectChanges ( ) ;
865+
866+ percentLabel = filterUIRow . query ( By . css ( '.igx-grid__filtering-row-percent-hint' ) ) ;
867+ expect ( percentLabel ) . not . toBeNull ( ) ;
868+ expect ( percentLabel . nativeElement . textContent . trim ( ) ) . toEqual ( '3%' ) ;
869+ } ) ) ;
870+
871+ it ( 'should show percent suffix in ESF custom dialog when filtering a percent column' , fakeAsync ( ( ) => {
872+ const fix = TestBed . createComponent ( IgxGridPercentColumnComponent ) ;
873+ tick ( ) ;
874+ fix . detectChanges ( ) ;
875+
876+ const grid = fix . componentInstance . grid ;
877+ const discountColumn = grid . getColumnByName ( 'Discount' ) ;
878+ grid . allowFiltering = true ;
879+ grid . filterMode = 'excelStyleFilter' ;
880+ fix . detectChanges ( ) ;
881+
882+ GridFunctions . clickExcelFilterIcon ( fix , discountColumn . field ) ;
883+ tick ( 100 ) ;
884+ fix . detectChanges ( ) ;
885+
886+ GridFunctions . clickExcelFilterCascadeButton ( fix ) ;
887+ tick ( 100 ) ;
888+ fix . detectChanges ( ) ;
889+
890+ // Open custom filter dialog by selecting first operator (Equals)
891+ GridFunctions . clickOperatorFromCascadeMenu ( fix , 0 ) ;
892+ tick ( 200 ) ;
893+ fix . detectChanges ( ) ;
894+
895+ const exprComponents = GridFunctions . getExcelCustomFilteringDefaultExpressions ( fix ) ;
896+ expect ( exprComponents . length ) . toBeGreaterThan ( 0 ) ;
897+
898+ // Percent label should not be visible before entering a value
899+ let percentLabel = exprComponents [ 0 ] . querySelector ( '.igx-grid__filtering-row-percent-hint' ) ;
900+ expect ( percentLabel ) . toBeNull ( ) ;
901+
902+ // Enter a value to trigger the suffix
903+ GridFunctions . setInputValueESF ( fix , 0 , 0.05 ) ;
904+ tick ( 100 ) ;
905+ fix . detectChanges ( ) ;
906+
907+ percentLabel = exprComponents [ 0 ] . querySelector ( '.igx-grid__filtering-row-percent-hint' ) ;
908+ expect ( percentLabel ) . not . toBeNull ( ) ;
909+ expect ( percentLabel . textContent . trim ( ) ) . toEqual ( '5%' ) ;
910+ } ) ) ;
911+
841912 } ) ;
842913
843914 describe ( 'Date, DateTime and Time column tests' , ( ) => {
0 commit comments