Scheduler - Create isolated AppointmentPopup test environment#33002
Scheduler - Create isolated AppointmentPopup test environment#33002aleksei-semikozov wants to merge 1 commit intoDevExpress:26_1from
Conversation
d9420d7 to
1385ce5
Compare
There was a problem hiding this comment.
Pull request overview
Adds an isolated Jest (JSDOM) test harness for the Scheduler AppointmentPopup, allowing the popup + form to be instantiated and asserted without creating a full Scheduler instance.
Changes:
- Added a new
appointment_popup.test.tssuite that validates basic popup rendering, form binding, and Save/Cancel behavior. - Introduced a dedicated
createAppointmentPopuptest helper and centralized cleanup viadisposeAppointmentPopups.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/devextreme/js/__internal/scheduler/tests/appointment_popup.test.ts | New isolated AppointmentPopup tests covering rendering, data binding, and Save/Cancel actions. |
| packages/devextreme/js/__internal/scheduler/tests/mock/create_appointment_popup.ts | New helper to construct an AppointmentPopup + AppointmentForm with minimal scheduler proxies and deterministic cleanup. |
|
|
||
| describe('Isolated AppointmentPopup environment', () => { | ||
| beforeEach(() => { | ||
| fx.off = true; |
There was a problem hiding this comment.
Consider calling setupSchedulerTestEnvironment() (or at least stubbing DOMComponent.prototype._isVisible) in beforeEach. Most other Scheduler jsdom tests do this to avoid :visible returning false in JSDOM, which can make overlay/popup rendering and visibility-dependent logic flaky.
| fx.off = true; | |
| fx.off = true; | |
| setupSchedulerTestEnvironment(); |
| interface CreateAppointmentPopupOptions { | ||
| appointmentData?: Record<string, unknown>; | ||
| action?: number; | ||
| editing?: Record<string, unknown>; | ||
| firstDayOfWeek?: number; | ||
| startDayHour?: number; | ||
| onAppointmentFormOpening?: (...args: unknown[]) => void; | ||
| addAppointment?: jest.Mock; | ||
| updateAppointment?: jest.Mock; | ||
| } |
There was a problem hiding this comment.
The option types here are very generic (Record<string, unknown>, number), which reduces the value of these helpers and can hide breaking changes in the popup contract. Consider typing appointmentData as Partial<SafeAppointment> (or similar) and action as a union of ACTION_TO_APPOINTMENT values, and tightening editing to the scheduler editing config shape used by AppointmentPopup/AppointmentForm.
No description provided.