Because our DatePicker implementations need custom logic for keyUp and keyDown events, it's critical that our unit tests simulate key presses instead of just populating entire preset values. We are currently unable to update any DatePicker's value with the react testing library fireEvents (@testing-library/react). We're aware that React also has Keyboard events available in the user-event library, but the installation conflicts with our kendo library dependencies. How do we get fireEvent keyUp/Down events to change a DatePicker's value, or is this not possible in KendoReact?
test("update datepicker value with key events", () => {
render(
<DatePicker id="testDatePicker" defaultValue={new Date("10/11/2024")} />,
);
const dateInput = screen.getByRole("combobox");
act(() => {
fireEvent.keyDown(dateInput, { key: "2", code: "Digit2" });
fireEvent.keyUp(dateInput, { key: "2", code: "Digit2" });
});
expect(dateInput).toHaveDisplayValue(["02/11/2024"]);
});