Skip to content

Commit 5490200

Browse files
Scheduler - Add scroll-after-save test to scheduler.test.ts
1 parent da94e76 commit 5490200

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

packages/devextreme/js/__internal/scheduler/__tests__/scheduler.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,30 @@ describe('Scheduler scrollTo', () => {
6363
expect(loggerWarnSpy).toHaveBeenCalledTimes(0);
6464
});
6565

66+
it('should scroll to appointment position after saving from popup', async () => {
67+
const { container, scheduler, POM } = await createScheduler({
68+
dataSource: [{
69+
text: 'Late appointment',
70+
startDate: new Date(2017, 4, 25, 22, 0),
71+
endDate: new Date(2017, 4, 25, 23, 0),
72+
}],
73+
views: ['timelineDay'],
74+
currentView: 'timelineDay',
75+
currentDate: new Date(2017, 4, 25),
76+
});
77+
78+
const scrollableElement = container.querySelector('.dx-scheduler-date-table-scrollable') as HTMLElement;
79+
const scrollableContainer = scrollableElement.querySelector('.dx-scrollable-container') as HTMLElement;
80+
81+
expect(scrollableContainer.scrollLeft).toBe(0);
82+
83+
const item = (scheduler as any).getDataSource().items()[0];
84+
scheduler.showAppointmentPopup(item);
85+
POM.popup.saveButton.click();
86+
87+
expect(scrollableContainer.scrollLeft).toBeGreaterThan(0);
88+
});
89+
6690
it('should pass different left offsets for "start" vs "center" alignInView', async () => {
6791
const { container, scheduler } = await createScheduler({
6892
dataSource: [],

0 commit comments

Comments
 (0)