-
Notifications
You must be signed in to change notification settings - Fork 620
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
T1235433: fix Drag-n-Drop inside the group with virtual scrolling (#2…
…9138) Co-authored-by: Vladimir Bushmanov <vladimir.bushmanov@devexpress.com>
- Loading branch information
Showing
18 changed files
with
213 additions
and
96 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...stcafe-devextreme/tests/scheduler/common/cellsSelection/bothDirectionsVirtualScrolling.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...estcafe-devextreme/tests/scheduler/common/cellsSelection/virtualScrollingCellSelection.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
e2e/testcafe-devextreme/tests/scheduler/common/dragAndDrop/T1235433.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
import Scheduler from 'devextreme-testcafe-models/scheduler'; | ||
import type Appointment from 'devextreme-testcafe-models/scheduler/appointment'; | ||
import { createWidget } from '../../../../helpers/createWidget'; | ||
import url from '../../../../helpers/getPageUrl'; | ||
import { scrollTo } from '../../utils'; | ||
|
||
fixture.disablePageReloads`Scheduler Drag-and-Drop inside Group` | ||
.page(url(__dirname, '../../../container.html')); | ||
|
||
const dragAppointmentByCircle = async ( | ||
t: TestController, | ||
appointment: Appointment, | ||
times: string[], | ||
) => { | ||
await t.drag(appointment.element, -200, 0) | ||
.expect(appointment.date.time) | ||
.eql(times[0]); | ||
|
||
await t.drag(appointment.element, 0, 200) | ||
.expect(appointment.date.time) | ||
.eql(times[1]); | ||
|
||
await t.drag(appointment.element, 200, 0) | ||
.expect(appointment.date.time) | ||
.eql(times[2]); | ||
|
||
await t.drag(appointment.element, 0, -200) | ||
.expect(appointment.date.time) | ||
.eql(times[3]); | ||
}; | ||
const appointment1Times = ['9:00 AM - 10:00 AM', '9:00 AM - 10:00 AM', '10:00 AM - 11:00 AM', '10:00 AM - 11:00 AM']; | ||
const appointment2Times = ['4:00 PM - 5:15 PM', '4:00 PM - 5:15 PM', '5:00 PM - 6:15 PM', '5:00 PM - 6:15 PM']; | ||
const schedulerConfig = { | ||
timeZone: 'America/Los_Angeles', | ||
dataSource: [ | ||
{ | ||
text: 'Book 1', | ||
startDate: new Date('2021-02-02T18:00:00.000Z'), | ||
endDate: new Date('2021-02-02T19:00:00.000Z'), | ||
priority: 1, | ||
}, { | ||
text: 'Book 2', | ||
startDate: new Date('2021-02-03T01:00:00.000Z'), | ||
endDate: new Date('2021-02-03T02:15:00.000Z'), | ||
priority: 1, | ||
}, { | ||
text: 'Book 3', | ||
startDate: new Date('2021-02-09T01:00:00.000Z'), | ||
endDate: new Date('2021-02-09T02:15:00.000Z'), | ||
priority: 1, | ||
}, | ||
], | ||
views: ['timelineDay', 'timelineWorkWeek', 'timelineMonth'], | ||
currentView: 'timelineDay', | ||
currentDate: new Date('2021-02-02T17:00:00.000Z'), | ||
firstDayOfWeek: 0, | ||
scrolling: { mode: 'virtual' }, | ||
startDayHour: 8, | ||
endDayHour: 20, | ||
cellDuration: 60, | ||
groups: ['priority'], | ||
useDropDownViewSwitcher: false, | ||
resources: [{ | ||
fieldExpr: 'priority', | ||
dataSource: [ | ||
{ id: 1, text: 'Low Priority', color: 'green' }, | ||
{ id: 2, text: 'High Priority', color: 'blue' }, | ||
], | ||
label: 'Priority', | ||
}], | ||
height: 580, | ||
}; | ||
|
||
test('T1235433: Scheduler - Drag-n-Drop works inside the group with virtual scrolling', async (t) => { | ||
const scheduler = new Scheduler('#container'); | ||
|
||
await t.expect(scheduler.element.exists).ok(); | ||
|
||
await dragAppointmentByCircle(t, scheduler.getAppointment('Book 1'), appointment1Times); | ||
await scrollTo(1400, 0); | ||
await dragAppointmentByCircle(t, scheduler.getAppointment('Book 2'), appointment2Times); | ||
|
||
await t.click(scheduler.toolbar.viewSwitcher.getButton('Timeline Work Week').element) | ||
.expect(scheduler.checkViewType('timelineWorkWeek')) | ||
.ok(); | ||
await scrollTo(2400, 0); | ||
await dragAppointmentByCircle(t, scheduler.getAppointment('Book 1'), appointment1Times); | ||
await scrollTo(3400, 0); | ||
await dragAppointmentByCircle(t, scheduler.getAppointment('Book 2'), appointment2Times); | ||
}).before(async () => createWidget('dxScheduler', schedulerConfig)); | ||
|
||
test('T1235433: Scheduler - Drag-n-Drop works inside the group with virtual scrolling (Timeline Month)', async (t) => { | ||
const scheduler = new Scheduler('#container'); | ||
|
||
await t.expect(scheduler.element.exists).ok(); | ||
|
||
await dragAppointmentByCircle(t, scheduler.getAppointment('Book 1'), [ | ||
'1: 1.1', | ||
'2: 1.1', | ||
'2: 1.2', | ||
'1: 1.2', | ||
]); | ||
await scrollTo(1000, 0); | ||
await dragAppointmentByCircle(t, scheduler.getAppointment('Book 3'), [ | ||
'1: 1.8', | ||
'2: 1.8', | ||
'2: 1.9', | ||
'1: 1.9', | ||
]); | ||
}).before(async () => createWidget('dxScheduler', { | ||
...schedulerConfig, | ||
currentView: 'timelineMonth', | ||
appointmentTemplate({ appointmentData }) { | ||
return $(` | ||
<div style="display: contents"> | ||
<div class="dx-scheduler-appointment-title">${appointmentData.text}</div> | ||
<div class="dx-scheduler-appointment-content-details"> | ||
<div class="dx-scheduler-appointment-content-date">${appointmentData.priority}: ${appointmentData.startDate.getMonth()}.${appointmentData.startDate.getDate()}</div> | ||
</div> | ||
</div> | ||
`); | ||
}, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ClientFunction } from 'testcafe'; | ||
|
||
export const scrollTo = ClientFunction((x, y) => { | ||
const instance = ($('#container') as any).dxScheduler('instance'); | ||
const scrollable = instance.getWorkSpaceScrollable(); | ||
|
||
scrollable.scrollTo({ y, x }); | ||
}); | ||
|
||
export const scrollToDate = ClientFunction((date: Date, groups?: Record<string, unknown>) => { | ||
const instance = ($('#container') as any).dxScheduler('instance'); | ||
|
||
instance.scrollTo(date, groups); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.