Skip to content

Commit f7cbda9

Browse files
authored
Scheduler: avoid mutation on appointment resize (T1287704) (#30097)
Co-authored-by: Vladimir Bushmanov <[email protected]>
1 parent 2cb4123 commit f7cbda9

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

packages/devextreme/js/__internal/scheduler/appointments/m_appointment_collection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ class SchedulerAppointments extends CollectionWidget {
716716
sourceAppointment,
717717
dataAccessors,
718718
timeZoneCalculator,
719-
);
719+
).clone();
720720

721721
gridAdapter.startDate = new Date(dateRange.startDate);
722722
gridAdapter.endDate = new Date(dateRange.endDate);

packages/devextreme/testing/tests/DevExpress.ui.widgets.scheduler/appointment.editing.tests.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,28 @@ module('Integration: Appointment editing', {
188188
}
189189
});
190190

191+
test('onAppointmentUpdating should be correct after resizing', function(assert) {
192+
const scheduler = this.createInstance({
193+
currentDate: new Date(2015, 1, 9),
194+
dataSource: this.tasks,
195+
editing: true,
196+
onAppointmentUpdating: (e) => {
197+
assert.deepEqual(e.oldData, this.tasks[0], 'Target item is correct');
198+
assert.deepEqual(e.newData, $.extend(true, oldItem, { endDate: new Date(2015, 1, 9, 3, 0) }), 'New data is correct');
199+
}
200+
});
201+
202+
const oldItem = this.tasks[0];
203+
204+
const cellHeight = getOuterHeight(scheduler.instance.$element().find('.' + DATE_TABLE_CELL_CLASS).eq(0));
205+
const hourHeight = cellHeight * 2;
206+
207+
const pointer = pointerMock(scheduler.instance.$element().find('.dx-resizable-handle-bottom').eq(0)).start();
208+
pointer.dragStart().drag(0, hourHeight).dragEnd();
209+
210+
assert.expect(2);
211+
});
212+
191213
test('Add new appointment', function(assert) {
192214
const data = new DataSource({
193215
store: this.tasks

0 commit comments

Comments
 (0)