Skip to content

Commit f4de2c1

Browse files
committed
apply review
1 parent f5ceec8 commit f4de2c1

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

packages/devextreme/js/__internal/scheduler/appointments_new/appointments.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,29 @@ describe('Appointments', () => {
168168
expect(instance.$element().find(`.${APPOINTMENT_CLASSES.CONTAINER}`).length).toBe(1);
169169
expect($allDayContainer.find(`.${APPOINTMENT_CLASSES.CONTAINER}`).length).toBe(0);
170170
});
171+
172+
it('should clean all day container when switching from grid view to agenda view', () => {
173+
const $allDayContainer = $('.allday-container');
174+
175+
const instance = createAppointments({
176+
...getProperties(),
177+
currentView: 'week',
178+
$allDayContainer,
179+
});
180+
instance.option('viewModel', [
181+
mockGridViewModel({ ...defaultAppointmentData, allDay: true }, { sortedIndex: 0 }),
182+
]);
183+
184+
expect($allDayContainer.find(`.${APPOINTMENT_CLASSES.CONTAINER}`).length).toBe(1);
185+
186+
instance.option('currentView', 'agenda');
187+
instance.option('viewModel', [
188+
mockAgendaViewModel({ ...defaultAppointmentData, allDay: true }, { sortedIndex: 0 }),
189+
]);
190+
191+
expect($allDayContainer.find(`.${APPOINTMENT_CLASSES.CONTAINER}`).length).toBe(0);
192+
expect(instance.$element().find(`.${APPOINTMENT_CLASSES.CONTAINER}`).length).toBe(1);
193+
});
171194
});
172195

173196
describe('Partial rendering', () => {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,11 @@ export class Appointments extends DOMComponent<Appointments, AppointmentsPropert
139139
}
140140

141141
private renderAgendaAppointments(appointments: AppointmentViewModelPlain[]): void {
142+
this.$allDayContainer?.empty();
143+
142144
const commonFragment = domAdapter.createDocumentFragment();
143145

146+
this.appointmentBySortIndex = {};
144147
this.$commonContainer.empty();
145148

146149
appointments.forEach((appointmentViewModel) => {

0 commit comments

Comments
 (0)