diff --git a/packages/devextreme-react/src/core/__tests__/integration/scheduler.test.tsx b/packages/devextreme-react/src/core/__tests__/integration/scheduler.test.tsx new file mode 100644 index 000000000000..8b0ae7b8156e --- /dev/null +++ b/packages/devextreme-react/src/core/__tests__/integration/scheduler.test.tsx @@ -0,0 +1,63 @@ +import * as testingLib from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import * as React from 'react'; +import { Scheduler } from '../../../scheduler'; + +describe('Scheduler component', () => { + beforeEach(() => { + jest.useRealTimers(); + }); + + afterEach(() => { + testingLib.cleanup(); + jest.useFakeTimers(); + }); + + it('T1311967: re-renders dateCellRender content after navigation', async () => { + const currentDate = new Date(2025, 2, 28); + const data = [ + { + text: 'Test Appointment', + startDate: new Date('2025-03-29T10:00:00'), + endDate: new Date('2025-03-29T11:00:00'), + }, + ]; + + const user = userEvent.setup({ delay: null }); + + const dateCellRender = (cellData: any) => { + const date = new Date(cellData.date); + return
Day {date.getDate()}
; + }; + + testingLib.render( + , + ); + + await testingLib.waitFor(() => { + const cells = document.querySelectorAll('.custom-cell-marker'); + const hasMarchDates = Array.from(cells).some((cell) => cell.textContent?.includes('Day 28') ?? cell.textContent?.includes('Day 29')); + expect(hasMarchDates).toBe(true); + }); + + const nextButton = await testingLib.waitFor(() => { + const btn = document.querySelector('[aria-label="Next page"]') as HTMLElement; + expect(btn).toBeDefined(); + return btn; + }); + await user.click(nextButton); + + await testingLib.waitFor(() => { + const cells = document.querySelectorAll('.custom-cell-marker'); + const hasAprilDates = Array.from(cells).some((cell) => cell.textContent?.includes('Day 4') ?? cell.textContent?.includes('Day 5')); + expect(hasAprilDates).toBe(true); + }); + }); +});