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

Fix Scheduler recurrenceEditor readOnly state for disabled appointments (T880614) #12918

Merged
merged 3 commits into from
May 7, 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
6 changes: 4 additions & 2 deletions js/ui/scheduler/appointmentPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,16 @@ export default class AppointmentPopup {
const allowEditingTimeZones = this.scheduler.option('editing').allowEditingTimeZones;
const appointmentData = this.state.appointment.data;
const formData = this._createAppointmentFormData(appointmentData);
const readOnly = this._isReadOnly(appointmentData);

AppointmentForm.prepareAppointmentFormEditors(
expr,
this.scheduler,
this.triggerResize.bind(this),
this.changeSize.bind(this),
formData,
allowEditingTimeZones
allowEditingTimeZones,
readOnly
);

if(resources && resources.length) {
Expand All @@ -163,7 +165,7 @@ export default class AppointmentPopup {
return AppointmentForm.create(
this.scheduler._createComponent.bind(this.scheduler),
element,
this._isReadOnly(appointmentData),
readOnly,
formData,
);
}
Expand Down
3 changes: 2 additions & 1 deletion js/ui/scheduler/ui.scheduler.appointment_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ const SchedulerAppointmentForm = {
];
},

prepareAppointmentFormEditors: function(dataExprs, schedulerInst, triggerResize, changeSize, appointmentData, allowEditingTimeZones) {
prepareAppointmentFormEditors: function(dataExprs, schedulerInst, triggerResize, changeSize, appointmentData, allowEditingTimeZones, readOnly) {
const recurrenceEditorVisibility = !!this.getRecurrenceRule(appointmentData, dataExprs);

this._editors = [
Expand All @@ -247,6 +247,7 @@ const SchedulerAppointmentForm = {
dataField: dataExprs.recurrenceRuleExpr,
editorType: 'dxRecurrenceEditor',
editorOptions: {
readOnly: readOnly,
firstDayOfWeek: schedulerInst.option('firstDayOfWeek'),
onInitialized: (e) => {
const form = this._appointmentForm;
Expand Down
3 changes: 3 additions & 0 deletions testing/functional/model/scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class AppointmentPopup {
doneButton: Selector;
cancelButton: Selector;

freqElement: Selector;

constructor(scheduler: Selector) {
this.element = scheduler.find(`.${CLASS.popup}.${CLASS.appointmentPopup}`);
Expand All @@ -137,6 +138,8 @@ class AppointmentPopup {
this.descriptionElement = this.wrapper.find(".dx-texteditor-input").nth(3);
this.allDayElement = this.wrapper.find(".dx-switch").nth(0);

this.freqElement = this.wrapper.find(".dx-recurrence-selectbox-freq");

this.doneButton = this.wrapper.find(".dx-popup-done.dx-button");
this.cancelButton = this.wrapper.find(`.${CLASS.cancelButton}`);
}
Expand Down
8 changes: 6 additions & 2 deletions testing/functional/tests/scheduler/appointmentForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,14 @@ test("Appointment should have correct form data on consecutive shows (T832711)",
height: 580
}, true));

test("From on disabled appointments should be read only (T835731)", async t => {
test("From elements for disabled appointments should be read only (T835731)", async t => {
const APPOINTMENT_TEXT = "Install New Router in Dev Room";
const scheduler = new Scheduler("#container");
const { appointmentPopup } = scheduler;

await t.doubleClick(scheduler.getAppointment(APPOINTMENT_TEXT).element)
.expect(appointmentPopup.freqElement.hasClass('dx-state-readonly')).ok()

.expect(appointmentPopup.subjectElement.value)
.eql(APPOINTMENT_TEXT)

Expand All @@ -157,9 +159,11 @@ await t.doubleClick(scheduler.getAppointment(APPOINTMENT_TEXT).element)
text: "Install New Router in Dev Room",
startDate: new Date(2017, 4, 22, 14, 30),
endDate: new Date(2017, 4, 25, 15, 30),
disabled: true
disabled: true,
recurrenceRule: "FREQ=DAILY"
}],
currentView: "week",
recurrenceEditMode: 'series',
currentDate: new Date(2017, 4, 25),
startDayHour: 9,
height: 600,
Expand Down