Skip to content

Commit 1d503db

Browse files
authored
Appointment Form Redesign: Repeat editor has visual bug when allowUpdating is false (#31600)
1 parent 59f6c10 commit 1d503db

File tree

8 files changed

+120
-3
lines changed

8 files changed

+120
-3
lines changed
Loading
27.8 KB
Loading

e2e/testcafe-devextreme/tests/scheduler/common/appointmentForm/form.visual.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,43 @@ test.meta({ browserSize: [1500, 1500] })('main form with resources that have ico
163163
currentDate: new Date(2021, 2, 25),
164164
resources: getResources(true),
165165
}));
166+
167+
test.meta({ browserSize: [1500, 1500] })('appointment form readonly state', async (t) => {
168+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
169+
170+
const appointment = {
171+
text: 'Appointment',
172+
startDate: new Date('2021-04-26T16:30:00.000Z'),
173+
endDate: new Date('2021-04-26T18:30:00.000Z'),
174+
allDay: false,
175+
recurrenceRule: 'FREQ=WEEKLY;BYDAY=MO,TH;COUNT=10',
176+
assigneeId: [1, 2],
177+
roomId: 1,
178+
priorityId: 1,
179+
};
180+
181+
const appointmentPopup = await openAppointmentPopup(t, appointment, false);
182+
183+
await testScreenshot(
184+
t,
185+
takeScreenshot,
186+
'scheduler__appointment__main-form__readonly.png',
187+
{ element: appointmentPopup.contentElement },
188+
);
189+
190+
await t
191+
.expect(compareResults.isValid())
192+
.ok(compareResults.errorMessages());
193+
}).before(async () => {
194+
await createWidget('dxScheduler', {
195+
dataSource: [],
196+
views: ['week'],
197+
currentView: 'week',
198+
currentDate: new Date(2021, 2, 25),
199+
resources: getResources(),
200+
editing: {
201+
allowUpdating: false,
202+
allowTimeZoneEditing: true,
203+
},
204+
});
205+
});

e2e/testcafe-devextreme/tests/scheduler/common/appointmentForm/recurrence-form.visual.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,3 +745,47 @@ test.clientScripts([
745745
(window as any).MockDate.reset();
746746
})();
747747
});
748+
749+
test.clientScripts([
750+
{ module: 'mockdate' },
751+
{ content: 'window.MockDate = MockDate;' },
752+
])('recurrence form readonly state', async (t) => {
753+
await ClientFunction(() => {
754+
(window as any).MockDate.set('2025/10/29');
755+
})();
756+
757+
const appointment = {
758+
text: 'Readonly Recurrent Appointment',
759+
startDate: new Date('2024-01-01T10:00:00'),
760+
endDate: new Date('2024-01-01T11:00:00'),
761+
recurrenceRule: 'FREQ=WEEKLY;BYDAY=MO,WE,FR;COUNT=10',
762+
};
763+
764+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
765+
766+
const appointmentPopup = await openAppointmentPopup(t, appointment, false);
767+
await appointmentPopup.openRecurrenceSettings(t);
768+
769+
await testScreenshot(
770+
t,
771+
takeScreenshot,
772+
'scheduler__recurrence-form__readonly.png',
773+
{ element: appointmentPopup.recurrence.group },
774+
);
775+
776+
await t
777+
.expect(compareResults.isValid())
778+
.ok(compareResults.errorMessages());
779+
}).before(async () => createWidget('dxScheduler', {
780+
dataSource: [],
781+
views: ['week'],
782+
currentView: 'week',
783+
currentDate: new Date(2024, 0, 1),
784+
editing: {
785+
allowUpdating: false,
786+
},
787+
})).after(async () => {
788+
await ClientFunction(() => {
789+
(window as any).MockDate.reset();
790+
})();
791+
});

packages/devextreme-scss/scss/widgets/base/scheduler/_index.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,14 @@ $scheduler-appointment-form-label-padding: 20px;
646646
}
647647
}
648648

649+
.dx-scheduler-form-repeat-editor .dx-selectbox.dx-state-readonly .dx-scheduler-form-recurrence-settings-button {
650+
margin-right: 0;
651+
652+
&::after {
653+
content: none;
654+
}
655+
}
656+
649657
/* Recurrence Day Buttons */
650658
.dx-scheduler-days-of-week-buttons {
651659
display: flex;

packages/devextreme/js/__internal/scheduler/appointment_popup/appointment_popup.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,29 @@ describe('Appointment Popup Form', () => {
440440
});
441441

442442
describe('Recurrence', () => {
443+
it('should allow opening recurrence settings when allowUpdating is false', async () => {
444+
const appointment = {
445+
text: 'Recurrent Appointment',
446+
startDate: new Date(2017, 4, 1, 9, 30),
447+
endDate: new Date(2017, 4, 1, 11),
448+
recurrenceRule: 'FREQ=WEEKLY;BYDAY=MO,WE,FR;COUNT=10',
449+
};
450+
451+
const { POM, scheduler } = await createScheduler({
452+
...getDefaultConfig(),
453+
editing: { allowUpdating: false },
454+
});
455+
456+
scheduler.showAppointmentPopup(appointment);
457+
458+
const recurrenceGroup = $(POM.popup.recurrenceGroup);
459+
expect(recurrenceGroup.hasClass(CLASSES.recurrenceGroupHidden)).toBe(true);
460+
461+
POM.popup.openRecurrenceSettings();
462+
463+
expect(recurrenceGroup.hasClass(CLASSES.recurrenceGroupHidden)).toBe(false);
464+
});
465+
443466
it('changes visibility of groups when opening recurrence form', async () => {
444467
const { scheduler, POM } = await createScheduler(getDefaultConfig());
445468

packages/devextreme/js/__internal/scheduler/appointment_popup/m_form.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,7 @@ export class AppointmentForm {
914914
location: 'after',
915915
name: 'settings',
916916
options: {
917+
disabled: false,
917918
icon: 'optionsoutline',
918919
stylingMode: 'text',
919920
onClick: (): void => {

packages/devextreme/js/__internal/scheduler/appointment_popup/m_recurrence_form.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ export class RecurrenceForm {
102102

103103
private _weekDayButtons: Record<string, dxButton> = {};
104104

105+
private _readOnly = false;
106+
105107
constructor(scheduler: Scheduler) {
106108
this.scheduler = scheduler;
107109
this.weekDayItems = this.createWeekDayItems();
@@ -161,9 +163,7 @@ export class RecurrenceForm {
161163
}
162164

163165
setReadOnly(value: boolean): void {
164-
Object.values(this._weekDayButtons).forEach((button) => {
165-
button?.option('disabled', value);
166-
});
166+
this._readOnly = value;
167167
}
168168

169169
get recurrenceRule(): RecurrenceRule {
@@ -333,6 +333,7 @@ export class RecurrenceForm {
333333

334334
this._weekDayButtons[item.key] = this.scheduler.createComponent(buttonContainer, Button, {
335335
text: item.text,
336+
disabled: this._readOnly,
336337
onClick: (): void => {
337338
const isSelected = this.recurrenceRule.byDay.includes(item.key);
338339

0 commit comments

Comments
 (0)