@@ -51,12 +51,13 @@ import { GridSelectionMode, FilterMode, Size } from '../common/enums';
5151import { ControlsFunction } from '../../test-utils/controls-functions.spec' ;
5252import { FilteringStrategy , FormattedValuesFilteringStrategy } from '../../data-operations/filtering-strategy' ;
5353import { IgxInputGroupComponent } from '../../input-group/public_api' ;
54- import { formatDate , getComponentSize } from '../../core/utils' ;
54+ import { getComponentSize } from '../../core/utils' ;
5555import { IgxCalendarComponent } from '../../calendar/calendar.component' ;
5656import { GridResourceStringsEN } from '../../core/i18n/grid-resources' ;
5757import { setElementSize } from '../../test-utils/helper-utils.spec' ;
5858import { IgxDateTimeEditorDirective } from '../../directives/date-time-editor/date-time-editor.directive' ;
5959import { IgxTimePickerComponent } from '../../time-picker/time-picker.component' ;
60+ import { HelperTestFunctions } from '../../test-utils/calendar-helper-utils' ;
6061
6162const DEBOUNCE_TIME = 30 ;
6263const FILTER_UI_ROW = 'igx-grid-filtering-row' ;
@@ -5054,6 +5055,62 @@ describe('IgxGrid - Filtering actions - Excel style filtering #grid', () => {
50545055 expect ( grid . filteredData . length ) . toEqual ( 1 ) ;
50555056 } ) ) ;
50565057
5058+ it ( 'Should properly scroll to prev/next period in custom date filter dialog.' , fakeAsync ( ( ) => {
5059+ // Open excel style custom filtering dialog.
5060+ GridFunctions . clickExcelFilterIcon ( fix , 'ReleaseDate' ) ;
5061+ tick ( 100 ) ;
5062+ fix . detectChanges ( ) ;
5063+ GridFunctions . clickExcelFilterCascadeButton ( fix ) ;
5064+ fix . detectChanges ( ) ;
5065+
5066+ GridFunctions . clickOperatorFromCascadeMenu ( fix , 0 ) ;
5067+ tick ( 200 ) ;
5068+
5069+ const expr = GridFunctions . getExcelCustomFilteringDateExpressions ( fix ) [ 0 ] ;
5070+ const datePicker = expr . querySelector ( 'igx-date-picker' ) ;
5071+ const input = datePicker . querySelector ( 'input' ) ;
5072+ UIInteractions . simulateClickEvent ( input ) ;
5073+ fix . detectChanges ( ) ;
5074+
5075+ // Click today item.
5076+ const calendar = document . querySelector ( 'igx-calendar' ) ;
5077+ const todayItem = calendar . querySelector ( '.igx-days-view__date--current' ) ;
5078+ UIInteractions . simulateClickAndSelectEvent ( todayItem . firstChild ) ;
5079+ tick ( 100 ) ;
5080+ fix . detectChanges ( ) ;
5081+ flush ( ) ;
5082+
5083+ // Reopen calender and click previous month button.
5084+ UIInteractions . simulateClickEvent ( input ) ;
5085+ fix . detectChanges ( ) ;
5086+
5087+ const prevMonthButton = fix . debugElement . queryAll (
5088+ By . css ( HelperTestFunctions . CALENDAR_PREV_BUTTON_CSSCLASS ) ,
5089+ ) [ 0 ] . nativeElement ;
5090+ prevMonthButton . focus ( ) ;
5091+ UIInteractions . simulateMouseEvent (
5092+ "mousedown" ,
5093+ prevMonthButton ,
5094+ 0 ,
5095+ 0 ,
5096+ ) ;
5097+ tick ( ) ;
5098+ UIInteractions . simulateMouseEvent (
5099+ "mouseup" ,
5100+ prevMonthButton ,
5101+ 0 ,
5102+ 0 ,
5103+ ) ;
5104+ fix . detectChanges ( ) ;
5105+
5106+ // Verify the calendar is scrolled to previous month.
5107+ const headerLabel = document . querySelector ( 'igx-calendar' ) . querySelector ( '.igx-calendar-picker__date' ) as HTMLElement ;
5108+ const today = new Date ( ) ;
5109+ const prevMonth = new Date ( today . setMonth ( today . getMonth ( ) - 1 ) ) ;
5110+ const monthName = prevMonth . toLocaleString ( 'default' , { month : 'short' } ) ;
5111+ expect ( headerLabel . innerText . trim ( ) ) . toMatch ( `${ monthName } ` ) ;
5112+ } ) ) ;
5113+
50575114 it ( 'Should take pipeArgs weekStart property as calendar\'s default.' , fakeAsync ( ( ) => {
50585115 const column = grid . getColumnByName ( 'ReleaseDate' ) ;
50595116
0 commit comments