Skip to content

Scheduler: Encapsulate old view model and add collector tests#30861

Merged
Ambrozy merged 6 commits intoDevExpress:25_2from
Ambrozy:25_2_collector_tests
Aug 27, 2025
Merged

Scheduler: Encapsulate old view model and add collector tests#30861
Ambrozy merged 6 commits intoDevExpress:25_2from
Ambrozy:25_2_collector_tests

Conversation

@Ambrozy
Copy link
Contributor

@Ambrozy Ambrozy commented Aug 25, 2025

No description provided.

@Ambrozy Ambrozy self-assigned this Aug 25, 2025
@Ambrozy Ambrozy requested a review from a team as a code owner August 25, 2025 07:24
@Ambrozy Ambrozy added the 25_2 label Aug 25, 2025
@Ambrozy Ambrozy changed the title Scheduler: add collector screenshot tests Scheduler: Encapsulate old view model and add collector tests Aug 27, 2025
import type { AppointmentItemViewModel } from './view_model/generate_view_model/types';

const toMs = dateUtils.dateToMilliseconds;
const VERTICAL_VIEW_TYPES = ['day', 'week', 'workWeek'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed this string is repeated in a couple of places. (in packages/devextreme/js/__internal/scheduler/appointments/resizing/get_delta_time.ts )
Maybe we could extract it as a constant to avoid duplication?

case VERTICAL_VIEW_TYPES.includes(viewType) && !isAllDay:
return getVerticalDeltaTime(args, initialSize, options);
default:
return isAllDay
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use case isAllDay: instead of the ternary operation
so you don’t need to branch further inside the default.

const APPOINTMENT_COLLECTOR_CONTENT_CLASS = `${APPOINTMENT_COLLECTOR_CLASS}-content`;

const WEEK_VIEW_COLLECTOR_OFFSET = 5;
const COMPACT_THEME_WEEK_VIEW_COLLECTOR_OFFSET = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that WEEK_VIEW_COLLECTOR_OFFSET and COMPACT_THEME_WEEK_VIEW_COLLECTOR_OFFSET were removed and are no longer used.
How is this offset handled now? Could this change affect the behavior in week view or in compact theme scenarios?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was unused code

}
}, () => {
QUnit.test('_collectorOffset option should be passed to SchedulerAppointments depending on the view', async function(assert) {
QUnit.test('_collectorOffset option should be depending on the view', async function(assert) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these tests for Material-based themes are not very useful.
They only check a private option passed down to appointments, but I couldn’t find any unit tests that cover this option in the collection appointments logic itself.

May be we can delete him? If we had integration tests

const appointments = scheduler.instance.getAppointmentsInstance();

assert.equal(appointments.option('_collectorOffset'), 20, 'SchedulerAppointments has correct _collectorOffset');
assert.equal(scheduler.instance.getCollectorOffset(), 20, 'SchedulerAppointments has correct _collectorOffset');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should change assert name, or remove this test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@Ambrozy Ambrozy merged commit 5c40ef2 into DevExpress:25_2 Aug 27, 2025
312 checks passed
@Ambrozy Ambrozy deleted the 25_2_collector_tests branch August 27, 2025 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants