Scheduler - Refactor Appointments Collection - KBN#33643
Open
bit-byte0 wants to merge 5 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the new Scheduler appointments architecture (appointments_new/) with keyboard navigation/activation and delete-by-key support, wiring these behaviors up from Scheduler into the new Appointments component and adding Jest coverage for the new key interactions.
Changes:
- Added
allowDelete,onDeleteKeyPress, andonItemActivatetoAppointmentsPropertiesand wired them fromScheduler. - Expanded
AppointmentsFocusControllerkey handling to support Delete/Home/End/Enter/Space. - Updated/added Jest tests to use
@testing-library/domkey events and to cover the new keyboard behaviors.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/devextreme/js/__internal/scheduler/m_scheduler.ts | Passes delete/activate callbacks + allowDelete into new Appointments configuration. |
| packages/devextreme/js/__internal/scheduler/appointments_new/appointments.ts | Extends AppointmentsProperties and provides default options for new callbacks/flags. |
| packages/devextreme/js/__internal/scheduler/appointments_new/appointments.focus_controller.ts | Implements the new key handling logic (Delete/Home/End/Enter/Space). |
| packages/devextreme/js/__internal/scheduler/appointments_new/appointments.test.ts | Updates keydown simulation and adds unit tests for Home/End and keyboard actions. |
| packages/devextreme/js/__internal/scheduler/tests/appointments_new.test.ts | Adds integration tests for deleting appointments via the Delete key (including recurring occurrences). |
Comment on lines
52
to
+56
| public onViewItemKeyDown(viewItem: ViewItem, e: KeyboardKeyDownEvent): void { | ||
| if (e.key === 'Tab') { | ||
| this.handleTabKeyDown(e, viewItem.option().sortedIndex); | ||
| switch (true) { | ||
| case e.key === 'Tab': | ||
| this.handleTabKeyDown(e, viewItem.option().sortedIndex); | ||
| break; |
| private handleEnterKeyDown(sortedIndex: number): void { | ||
| const { onItemActivate } = this.appointments.option(); | ||
| const entity = this.sortedAppointments[sortedIndex]; | ||
| onItemActivate({ data: entity?.itemData, target: null }); |
Comment on lines
+390
to
+395
| const appointment = POM.getAppointments()[0]; | ||
| appointment.element.focus(); | ||
| fireEvent.keyDown(appointment.element, { key: 'Delete' }); | ||
|
|
||
| expect(POM.getAppointments().length).toBe(0); | ||
| }); |
Comment on lines
+408
to
+415
| expect(POM.getAppointments().length).toBe(3); | ||
|
|
||
| const appointment = POM.getAppointments()[0]; | ||
| appointment.element.focus(); | ||
| fireEvent.keyDown(appointment.element, { key: 'Delete' }); | ||
|
|
||
| expect(POM.getAppointments().length).toBe(2); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Keyboard navigation for new
appointments_new/architecture (Del/Home/End/Enter/Space)How
allowDelete,onDeleteKeyPress,onItemActivateonAppointmentsPropertiesfocus_controller: switch(true) per key inonViewItemKeyDownstartDate, recurring delete excludes right instance