Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduler, remove skipTimezone checking after T834428 fixing #11680

Merged
merged 4 commits into from
Jan 27, 2020
Merged
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
2 changes: 1 addition & 1 deletion js/ui/scheduler/ui.scheduler.appointments.js
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ const SchedulerAppointments = CollectionWidget.inherit({
};
}

appointmentSetting.targetedAppointmentData = this.invoke('getTargetedAppointmentData', appointmentData, $appointment, true);
appointmentSetting.targetedAppointmentData = this.invoke('getTargetedAppointmentData', appointmentData, $appointment);

this._virtualAppointments[virtualGroupIndex].items.settings.push(appointmentSetting);
this._virtualAppointments[virtualGroupIndex].items.data.push(appointmentData);
Expand Down
4 changes: 2 additions & 2 deletions js/ui/scheduler/ui.scheduler.subscribes.js
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ const subscribes = {
return SchedulerTimezones.getTimezonesIdsByDisplayName(displayName);
},

getTargetedAppointmentData: function(appointmentData, appointmentElement, skipTimezoneConvert) {
getTargetedAppointmentData: function(appointmentData, appointmentElement) {
const $appointmentElement = $(appointmentElement);
const appointmentIndex = $appointmentElement.data(this._appointments._itemIndexKey());

Expand All @@ -778,7 +778,7 @@ const subscribes = {

extend(true, result, appointmentData, recurringData);

if(this._isAppointmentRecurrence(appointmentData) && !skipTimezoneConvert) {
if(this._isAppointmentRecurrence(appointmentData)) {
this._convertDatesByTimezoneBack(false, result); // TODO: temporary solution fox fix T848058, more information in the ticket
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3821,7 +3821,7 @@ QUnit.module('Appointments', () => {
return createWrapper($.extend(config, options));
};

const createTestForCommonData = (assert, skipCallCount = false) => {
const createTestForCommonData = (assert, scheduler, skipCallCount = false) => {
eventCallCount = 0;

return (model, index, container) => {
Expand All @@ -3841,7 +3841,6 @@ QUnit.module('Appointments', () => {

return (model, index, container) => {
const { appointmentData, targetedAppointmentData } = model;

const startDateExpr = scheduler.option('startDateExpr');
const endDateExpr = scheduler.option('endDateExpr');
const textExpr = scheduler.option('textExpr');
Expand Down Expand Up @@ -3983,54 +3982,58 @@ QUnit.module('Appointments', () => {
});

QUnit.module('appointmentTooltipTemplate', () => {
QUnit.test('model.targetedAppointmentData argument should have current appointment data', function(assert) {
const scheduler = createScheduler(commonData);
scheduler.option({ appointmentTooltipTemplate: createTestForCommonData(assert, true) });

for(let i = 0; i < 5; i++) {
scheduler.appointments.click(i);
}

assert.ok(eventCallCount === 5, 'appointmentTemplate should be raised');
});

QUnit.test('model.targetedAppointmentData argument should have current appointment data in case recurrence', function(assert) {
const scheduler = createScheduler(recurrenceData);
scheduler.option({ appointmentTooltipTemplate: createTestForRecurrenceData(assert, scheduler) });

for(let i = 0; i < 5; i++) {
scheduler.appointments.click(i);
const cases = [
{
data: commonData,
appointmentTooltip: createTestForCommonData,
name: 'common'
},
{
data: recurrenceData,
appointmentTooltip: createTestForRecurrenceData,
name: 'recurrence'
},
{
data: recurrenceAndCompactData,
appointmentTooltip: createTestForRecurrenceData,
name: 'recurrence in collector'
},
{
data: hourlyRecurrenceData,
options: {
textExpr: 'textCustom',
startDateExpr: 'startDateCustom',
endDateExpr: 'endDateCustom',
currentView: 'week'
},
appointmentTooltip: createTestForHourlyRecurrenceData,
name: 'hourly recurrence in collector'
},
{
data: hourlyRecurrenceData,
options: {
textExpr: 'textCustom',
startDateExpr: 'startDateCustom',
endDateExpr: 'endDateCustom',
currentView: 'week',
timeZone: 'Asia/Yekaterinburg'
},
appointmentTooltip: createTestForHourlyRecurrenceData,
name: 'hourly recurrence in collector, custom timezone is set'
}
];

assert.ok(eventCallCount === 5, 'appointmentTooltipTemplate should be raised');
});

QUnit.test('model.targetedAppointmentData argument should have current appointment data in case recurrence in collector', function(assert) {
const scheduler = createScheduler(recurrenceAndCompactData);
scheduler.option({ appointmentTooltipTemplate: createTestForRecurrenceData(assert, scheduler) });

for(let i = 0; i < 5; i++) {
scheduler.appointments.compact.click(i);
}
cases.forEach(testCase => {
QUnit.test(`model.targetedAppointmentData argument should have current appointment data, ${testCase.name} case`, function(assert) {
const scheduler = createScheduler(testCase.data, testCase.options);
scheduler.option('appointmentTooltipTemplate', testCase.appointmentTooltip(assert, scheduler, true));

assert.ok(eventCallCount === 5, 'appointmentTooltipTemplate should be raised');
});
for(let i = 0; i < 5; i++) {
scheduler.appointments.click(i);
}

QUnit.test('model.targetedAppointmentData argument should have current appointment data in case hourly recurrence in collector', function(assert) {
const scheduler = createScheduler(hourlyRecurrenceData, {
textExpr: 'textCustom',
startDateExpr: 'startDateCustom',
endDateExpr: 'endDateCustom',
currentView: 'week'
assert.ok(eventCallCount === 5, 'appointmentTemplate should be raised');
});

scheduler.option({ appointmentTooltipTemplate: createTestForHourlyRecurrenceData(assert, scheduler) });

for(let i = 0; i < 5; i++) {
scheduler.appointments.compact.click(i);
}

assert.ok(eventCallCount === 5, 'appointmentTooltipTemplate should be raised');
});
});

Expand Down