diff --git a/projects/igniteui-angular/src/lib/grids/filtering/excel-style/excel-style-date-expression.component.html b/projects/igniteui-angular/src/lib/grids/filtering/excel-style/excel-style-date-expression.component.html index 2f08599dcda..8121e9f6cb8 100644 --- a/projects/igniteui-angular/src/lib/grids/filtering/excel-style/excel-style-date-expression.component.html +++ b/projects/igniteui-angular/src/lib/grids/filtering/excel-style/excel-style-date-expression.component.html @@ -22,7 +22,7 @@ @if (column.dataType === 'date') { { expect(grid.filteredData.length).toEqual(1); })); + it('Should properly scroll to prev/next period in custom date filter dialog.', fakeAsync(() => { + // Open excel style custom filtering dialog. + GridFunctions.clickExcelFilterIcon(fix, 'ReleaseDate'); + tick(100); + fix.detectChanges(); + GridFunctions.clickExcelFilterCascadeButton(fix); + fix.detectChanges(); + + GridFunctions.clickOperatorFromCascadeMenu(fix, 0); + tick(200); + + const expr = GridFunctions.getExcelCustomFilteringDateExpressions(fix)[0]; + const datePicker = expr.querySelector('igx-date-picker'); + const input = datePicker.querySelector('input'); + UIInteractions.simulateClickEvent(input); + fix.detectChanges(); + + // Click today item. + const calendar = document.querySelector('igx-calendar'); + const todayItem = calendar.querySelector('.igx-days-view__date--current'); + UIInteractions.simulateClickAndSelectEvent(todayItem.firstChild); + tick(100); + fix.detectChanges(); + flush(); + + // Reopen calender and click previous month button. + UIInteractions.simulateClickEvent(input); + fix.detectChanges(); + + const prevMonthButton = fix.debugElement.queryAll( + By.css(HelperTestFunctions.CALENDAR_PREV_BUTTON_CSSCLASS), + )[0].nativeElement; + prevMonthButton.focus(); + UIInteractions.simulateMouseEvent( + "mousedown", + prevMonthButton, + 0, + 0, + ); + tick(); + UIInteractions.simulateMouseEvent( + "mouseup", + prevMonthButton, + 0, + 0, + ); + fix.detectChanges(); + + // Verify the calendar is scrolled to previous month. + const headerLabel = document.querySelector('igx-calendar').querySelector('.igx-calendar-picker__date') as HTMLElement; + const today = new Date(); + const prevMonth = new Date(today.setMonth(today.getMonth() - 1)); + const monthName = prevMonth.toLocaleString('default', { month: 'short' }); + expect(headerLabel.innerText.trim()).toMatch(`${monthName}`); + })); + it('Should take pipeArgs weekStart property as calendar\'s default.', fakeAsync(() => { const column = grid.getColumnByName('ReleaseDate');