Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
398 changes: 199 additions & 199 deletions packages/devextreme/js/__internal/scheduler/m_recurrence_editor.ts

Large diffs are not rendered by default.

616 changes: 310 additions & 306 deletions packages/devextreme/js/__internal/scheduler/m_scheduler.ts

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions packages/devextreme/js/__internal/scheduler/m_subscribes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ const subscribes = {
const { startDate } = info.sourceAppointment;

this._checkRecurringAppointment(options.target, options.data, startDate, () => {
this._updateAppointment(options.target, options.data, function () {
this.updateAppointmentCore(options.target, options.data, function () {
this._appointments.moveAppointmentBack();
});
});
},

getUpdatedData(rawAppointment) {
return this._getUpdatedData(rawAppointment);
return this.getUpdatedData(rawAppointment);
},

updateAppointmentAfterDrag({
Expand All @@ -85,7 +85,7 @@ const subscribes = {
const { info } = utils.dataAccessors.getAppointmentSettings(element) as AppointmentItemViewModel;
// NOTE: enrich target appointment with additional data from the source
// in case of one appointment of series will change
const targetedRawAppointment = extend({}, rawAppointment, this._getUpdatedData(rawAppointment));
const targetedRawAppointment = extend({}, rawAppointment, this.getUpdatedData(rawAppointment));

const fromAllDay = Boolean(rawAppointment.allDay);
const toAllDay = Boolean(targetedRawAppointment.allDay);
Expand All @@ -103,7 +103,7 @@ const subscribes = {

if (isDropToSelfScheduler && (!isDropToTheSameCell || isDragAndDropBetweenComponents || isDropBetweenAllDay)) {
this._checkRecurringAppointment(rawAppointment, targetedRawAppointment, info.sourceAppointment.startDate, () => {
this._updateAppointment(rawAppointment, targetedRawAppointment, onCancel, event);
this.updateAppointmentCore(rawAppointment, targetedRawAppointment, onCancel, event);
}, undefined, undefined, event);
} else {
onCancel();
Expand Down
4 changes: 2 additions & 2 deletions packages/devextreme/testing/helpers/scheduler/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,11 @@ export class SchedulerTestWrapper extends ElementWrapper {

getCancelButton: () => this.appointmentPopup.getPopup().find('.dx-popup-cancel'),
clickCancelButton: () => this.appointmentPopup.getCancelButton().trigger('dxclick'),
saveAppointmentData: () => this.instance._appointmentPopup.saveEditDataAsync.call(this.instance._appointmentPopup),
saveAppointmentData: () => this.instance.appointmentPopup.saveEditDataAsync.call(this.instance.appointmentPopup),

hasLoadPanel: () => this.appointmentPopup.getPopup().find('.dx-loadpanel').length !== 0,

getInstance: () => this.instance._appointmentPopup
getInstance: () => this.instance.appointmentPopup
};

this.appointmentForm = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ module('Integration: Appointment editing', {
currentView: 'timelineMonth'
});

const updateAppointment = scheduler.instance._updateAppointment;
const updateAppointment = scheduler.instance.updateAppointmentCore;
const spy = sinon.spy(noop);
const oldItem = data[0];

scheduler.instance._updateAppointment = spy;
scheduler.instance.updateAppointmentCore = spy;

const cellWidth = getOuterWidth(scheduler.instance.$element().find('.' + DATE_TABLE_CELL_CLASS).eq(0));

Expand All @@ -152,7 +152,7 @@ module('Integration: Appointment editing', {
assert.deepEqual(spy.getCall(0).args[0], oldItem, 'Target item is correct');
assert.deepEqual(spy.getCall(0).args[1], $.extend(true, oldItem, { endDate: new Date(2015, 1, 3, 2, 0) }), 'New data is correct');
} finally {
scheduler.instance._updateAppointment = updateAppointment;
scheduler.instance.updateAppointmentCore = updateAppointment;
}
});

Expand All @@ -163,11 +163,11 @@ module('Integration: Appointment editing', {

const scheduler = await this.createInstance({ currentDate: new Date(2015, 1, 9), dataSource: data, editing: true });

const updateAppointment = scheduler.instance._updateAppointment;
const updateAppointment = scheduler.instance.updateAppointmentCore;
const spy = sinon.spy(noop);
const oldItem = this.tasks[0];

scheduler.instance._updateAppointment = spy;
scheduler.instance.updateAppointmentCore = spy;

const cellHeight = getOuterHeight(scheduler.instance.$element().find('.' + DATE_TABLE_CELL_CLASS).eq(0));
const hourHeight = cellHeight * 2;
Expand All @@ -180,7 +180,7 @@ module('Integration: Appointment editing', {
assert.deepEqual(spy.getCall(0).args[0], oldItem, 'Target item is correct');
assert.deepEqual(spy.getCall(0).args[1], $.extend(true, oldItem, { endDate: new Date(2015, 1, 9, 3, 0) }), 'New data is correct');
} finally {
scheduler.instance._updateAppointment = updateAppointment;
scheduler.instance.updateAppointmentCore = updateAppointment;
}
});

Expand Down Expand Up @@ -268,7 +268,7 @@ module('Integration: Appointment editing', {

$('.dx-scheduler-appointment-popup .dx-popup-done').trigger('dxclick');

const popup = scheduler.instance._appointmentPopup.popup;
const popup = scheduler.instance.appointmentPopup.popup;
});

test('Add new appointment with delay and an error(T381444)', async function(assert) {
Expand Down Expand Up @@ -303,7 +303,7 @@ module('Integration: Appointment editing', {

$('.dx-scheduler-appointment-popup .dx-popup-done').trigger('dxclick');

const popup = scheduler.instance._appointmentPopup.popup;
const popup = scheduler.instance.appointmentPopup.popup;
});

// TODO: update editors in popup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ module('Integration: Appointments in Month view', {

$('.dx-dialog-buttons .dx-button').eq(0).trigger('dxclick');

const popup = scheduler.instance._appointmentPopup.popup;
const popup = scheduler.instance.appointmentPopup.popup;
const $buttonGroup = $(popup.$content()).find('.dx-buttongroup');

assert.deepEqual($buttonGroup.eq(0).dxButtonGroup('instance').option('selectedItemKeys'), ['MO', 'TH'], 'Right button group select item keys');
Expand Down Expand Up @@ -459,7 +459,7 @@ module('Integration: Appointments in Month view', {

$('.dx-dialog-buttons .dx-button').eq(0).trigger('dxclick');

const popup = scheduler.instance._appointmentPopup.popup;
const popup = scheduler.instance.appointmentPopup.popup;
const $buttonGroup = $(popup.$content()).find('.dx-buttongroup');

$buttonGroup.eq(0).dxButtonGroup('instance').option('selectedItemKeys'), ['MO', 'TH'], 'Right button group select item keys';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module('Integration: Appointment tooltip', {
height: 600
});

const getAppointmentDisabled = sinon.spy(scheduler.instance._appointmentTooltip._options, 'getAppointmentDisabled');
const getAppointmentDisabled = sinon.spy(scheduler.instance.appointmentTooltip._options, 'getAppointmentDisabled');

const clock = sinon.useFakeTimers();
await scheduler.appointments.click(0, clock);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ module('Integration: Appointment Day, Week views', {
height: 1500
});

const spy = sinon.spy(scheduler.instance._appointmentPopup, 'show');
const spy = sinon.spy(scheduler.instance.appointmentPopup, 'show');

const clock = sinon.useFakeTimers();
await scheduler.appointments.click(0, clock);
Expand All @@ -244,7 +244,7 @@ module('Integration: Appointment Day, Week views', {

hide();
} finally {
scheduler.instance._appointmentPopup.show.restore();
scheduler.instance.appointmentPopup.show.restore();
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -688,16 +688,16 @@ QUnit.module('Events', {

assert.equal(contentReadyFiresCount, 1, 'contentReadyFiresCount === 1');

scheduler.instance._workSpaceRecalculation = new Deferred();
scheduler.instance.workSpaceRecalculation = new Deferred();
scheduler.instance._fireContentReadyAction();

assert.equal(contentReadyFiresCount, 1, 'contentReadyFiresCount === 1');

scheduler.instance._workSpaceRecalculation.resolve();
scheduler.instance.workSpaceRecalculation.resolve();

assert.equal(contentReadyFiresCount, 2, 'contentReadyFiresCount === 2');

scheduler.instance._workSpaceRecalculation = null;
scheduler.instance.workSpaceRecalculation = null;
scheduler.instance._fireContentReadyAction();

assert.equal(contentReadyFiresCount, 3, 'contentReadyFiresCount === 3');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ QUnit.module('Methods', {
const appointments = scheduler.instance.getAppointmentsInstance();
const focusSpy = sinon.spy(appointments, 'focus');

scheduler.instance._editAppointmentData = tasks[0];
scheduler.instance.editAppointmentData = tasks[0];
scheduler.instance.focus();

assert.ok(focusSpy.calledOnce, 'focus is called');
Expand Down Expand Up @@ -636,49 +636,49 @@ QUnit.module('Methods', {

QUnit.test('showAppointmentTooltipCore, should call show tooltip', async function(assert) {
const scheduler = await createInstance({});
scheduler.instance._appointmentTooltip.isAlreadyShown = sinon.stub().returns(false);
scheduler.instance._appointmentTooltip.show = sinon.stub();
scheduler.instance._appointmentTooltip.hide = sinon.stub();
scheduler.instance.appointmentTooltip.isAlreadyShown = sinon.stub().returns(false);
scheduler.instance.appointmentTooltip.show = sinon.stub();
scheduler.instance.appointmentTooltip.hide = sinon.stub();
scheduler.instance.showAppointmentTooltipCore('target', [], 'options');

assert.ok(!scheduler.instance._appointmentTooltip.hide.called, 'hide tooltip is not called');
assert.ok(scheduler.instance._appointmentTooltip.show.called, 'show tooltip is called');
assert.ok(!scheduler.instance.appointmentTooltip.hide.called, 'hide tooltip is not called');
assert.ok(scheduler.instance.appointmentTooltip.show.called, 'show tooltip is called');
});

QUnit.test('showAppointmentTooltipCore, should call hide tooltip', async function(assert) {
const scheduler = await createInstance({});
scheduler.instance._appointmentTooltip.isAlreadyShown = sinon.stub().returns(true);
scheduler.instance._appointmentTooltip.show = sinon.stub();
scheduler.instance._appointmentTooltip.hide = sinon.stub();
scheduler.instance.appointmentTooltip.isAlreadyShown = sinon.stub().returns(true);
scheduler.instance.appointmentTooltip.show = sinon.stub();
scheduler.instance.appointmentTooltip.hide = sinon.stub();
scheduler.instance.showAppointmentTooltipCore('target', [], 'options');

assert.ok(scheduler.instance._appointmentTooltip.hide.called, 'hide tooltip is called');
assert.ok(!scheduler.instance._appointmentTooltip.show.called, 'show tooltip is not called');
assert.ok(scheduler.instance.appointmentTooltip.hide.called, 'hide tooltip is called');
assert.ok(!scheduler.instance.appointmentTooltip.show.called, 'show tooltip is not called');
});

QUnit.test('showAppointmentTooltip, should call show tooltip', async function(assert) {
const scheduler = await createInstance({});
scheduler.instance._appointmentTooltip.isAlreadyShown = sinon.stub().returns(false);
scheduler.instance._appointmentTooltip.show = sinon.stub();
scheduler.instance._appointmentTooltip.hide = sinon.stub();
scheduler.instance.appointmentTooltip.isAlreadyShown = sinon.stub().returns(false);
scheduler.instance.appointmentTooltip.show = sinon.stub();
scheduler.instance.appointmentTooltip.hide = sinon.stub();
scheduler.instance.showAppointmentTooltip('appointmentData', 'target', 'currentAppointmentData');

assert.ok(!scheduler.instance._appointmentTooltip.hide.called, 'hide tooltip is not called');
assert.ok(scheduler.instance._appointmentTooltip.show.called, 'show tooltip is called');
assert.ok(!scheduler.instance.appointmentTooltip.hide.called, 'hide tooltip is not called');
assert.ok(scheduler.instance.appointmentTooltip.show.called, 'show tooltip is called');
});

QUnit.test('showAppointmentTooltip, should call hide tooltip', async function(assert) {
const scheduler = await createInstance({});
scheduler.instance._appointmentTooltip.isAlreadyShown = sinon.stub().returns(true);
scheduler.instance._appointmentTooltip.show = sinon.stub();
scheduler.instance._appointmentTooltip.hide = sinon.stub();
scheduler.instance.appointmentTooltip.isAlreadyShown = sinon.stub().returns(true);
scheduler.instance.appointmentTooltip.show = sinon.stub();
scheduler.instance.appointmentTooltip.hide = sinon.stub();
scheduler.instance.showAppointmentTooltip('appointmentData', 'target', 'currentAppointmentData');

assert.ok(scheduler.instance._appointmentTooltip.hide.called, 'hide tooltip is called');
assert.ok(!scheduler.instance._appointmentTooltip.show.called, 'show tooltip is not called');
assert.ok(scheduler.instance.appointmentTooltip.hide.called, 'hide tooltip is called');
assert.ok(!scheduler.instance.appointmentTooltip.show.called, 'show tooltip is not called');
});

QUnit.test('_getUpdatedData for the empty data item (T906240)', async function(assert) {
QUnit.test('getUpdatedData for the empty data item (T906240)', async function(assert) {
const startCellDate = new Date(2020, 1, 2, 3);
const endCellDate = new Date(2020, 1, 2, 4);
const scheduler = await createWrapper({});
Expand All @@ -690,7 +690,7 @@ QUnit.module('Methods', {
};
};

const updatedData = scheduler.instance._getUpdatedData({ text: 'test' });
const updatedData = scheduler.instance.getUpdatedData({ text: 'test' });
assert.deepEqual(updatedData, {
endDate: endCellDate,
startDate: startCellDate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ QUnit.module('Options', () => {

const spyAppointmentPopupForm = sinon.spy(
scheduler.instance,
'_createAppointmentPopupForm'
'createAppointmentPopupForm'
);

scheduler.instance.option('resources', resources);
Expand Down Expand Up @@ -936,7 +936,7 @@ QUnit.module('Options', () => {
});

const initMarkupSpy = sinon.spy(scheduler.instance, '_initMarkup');
const reloadDataSourceSpy = sinon.spy(scheduler.instance, '_reloadDataSource');
const reloadDataSourceSpy = sinon.spy(scheduler.instance, 'reloadDataSource');
let count = 0;

const nextDataSource = new DataSource({
Expand All @@ -962,7 +962,7 @@ QUnit.module('Options', () => {
await waitForAsync(() => count === 2);

assert.equal(initMarkupSpy.callCount, 2, 'Init markup was called on each dataSource changes');
assert.equal(reloadDataSourceSpy.callCount, 2, '_reloadDataSource was called on each changes');
assert.equal(reloadDataSourceSpy.callCount, 2, 'reloadDataSource was called on each changes');
});

QUnit.test('It should be possible to change views option when view names are specified (T995794)', async function(assert) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ QUnit.module('View with configuration', () => {
});

assert.equal(scheduler.instance._workSpace.option('firstDayOfWeek'), 0, 'value of the firstDayOfWeek in workSpace');
assert.equal(scheduler.instance._header.option('firstDayOfWeek'), 0, 'value of the firstDayOfWeek in header');
assert.equal(scheduler.instance.header.option('firstDayOfWeek'), 0, 'value of the firstDayOfWeek in header');
});

QUnit.test('Scheduler should have specific groups setting of the view', async function(assert) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ module('Events', {
scheduler.instance.showAppointmentPopup(appointments[0]);
$('.dx-scheduler-appointment-popup .dx-popup-done').trigger('dxclick');

const appointmentForm = scheduler.instance._appointmentPopup.form;
const appointmentForm = scheduler.instance.appointmentPopup.form;

assert.deepEqual(appointmentForm.formData.startDate, new Date(2015, 1, 9, 13), 'Form data is correct');
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ module('Integration: Appointment tooltip', moduleConfig, () => {
assert.equal(Tooltip.getInstance($('.dx-tooltip')).option('rtlEnabled'), true, 'rtlEnabled for tooltip was set to true');
});

test('Click on tooltip-edit button should call scheduler._appointmentPopup and hide tooltip', async function(assert) {
test('Click on tooltip-edit button should call scheduler.appointmentPopup and hide tooltip', async function(assert) {
const data = new DataSource({
store: getSampleData()
});
Expand All @@ -319,7 +319,7 @@ module('Integration: Appointment tooltip', moduleConfig, () => {
dataSource: data
});

const stub = sinon.stub(scheduler.instance._appointmentPopup, 'show');
const stub = sinon.stub(scheduler.instance.appointmentPopup, 'show');

const clock = sinon.useFakeTimers();
await scheduler.appointments.click(1, clock);
Expand Down Expand Up @@ -585,7 +585,7 @@ module('Integration: Appointment tooltip', moduleConfig, () => {
}
]
});
const stub = sinon.stub(scheduler.instance, '_updateAppointment');
const stub = sinon.stub(scheduler.instance, 'updateAppointmentCore');

const clock = sinon.useFakeTimers();
await scheduler.appointments.click(1, clock);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,13 +381,13 @@ QUnit.module('Integration: Date navigator', moduleConfig, function() {
QUnit.test('Tasks should be rerendered after click on next/prev button', async function(assert) {
await this.createInstance({ currentDate: new Date(2015, 1, 24) });

const spy = sinon.spy(this.instance, '_setRemoteFilterIfNeeded');
const spy = sinon.spy(this.instance, 'setRemoteFilterIfNeeded');

try {
$(this.instance.$element()).find('.dx-scheduler-navigator-previous').trigger('dxclick');
assert.ok(spy.calledOnce, '_setRemoteFilterIfNeeded is called');
assert.ok(spy.calledOnce, 'setRemoteFilterIfNeeded is called');
} finally {
this.instance._setRemoteFilterIfNeeded.restore();
this.instance.setRemoteFilterIfNeeded.restore();
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ const { testStart } = QUnit;
testStart(() => initTestMarkup());

const mockWorkSpaceRendering = function(schedulerInst, cellSize, bounds) {
const base = schedulerInst._renderWorkSpace;
const base = schedulerInst.renderWorkSpace;
const getMaxAllowedPosition = (groupIndex) => {
return bounds[groupIndex];
};

sinon.stub(schedulerInst, '_renderWorkSpace').callsFake(function(groups) {
sinon.stub(schedulerInst, 'renderWorkSpace').callsFake(function(groups) {
base.call(this, groups);

sinon.stub(this._workSpace, 'getCellWidth').returns(cellSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ module('Integration: Work space', { ...moduleConfig }, () => {
]
});

const refreshStub = sinon.stub(scheduler.instance, '_refreshWorkSpace');
const refreshStub = sinon.stub(scheduler.instance, 'refreshWorkSpace');

try {
scheduler.instance.option('groups', ['resource2']);
Expand Down
Loading
Loading