Update DateTimeFields: improve UI layout and adjust time change logic

- Add separator '-' between start time and end time in normal mode
- Fix layout logic: keep single row for allday events in normal mode
- Remove auto-adjustment of start time when end time changes
- Update test case to match new behavior
This commit is contained in:
Lê Nhân Phụng
2025-12-08 10:46:11 +07:00
committed by Benoit TELLIER
parent a541111f88
commit 1347583e9a
2 changed files with 93 additions and 41 deletions
+20 -8
View File
@@ -97,7 +97,7 @@ describe("DateTimeFields", () => {
);
});
it("moves START backward when END moves before START (normal mode)", async () => {
it("does NOT move START backward when END moves before START (normal mode)", async () => {
await renderField({
startDate: "2025-01-01",
startTime: "10:00",
@@ -114,9 +114,9 @@ describe("DateTimeFields", () => {
expect(mockHandlers.onEndTimeChange).toHaveBeenCalledWith("08:00")
);
await waitFor(() =>
expect(mockHandlers.onStartTimeChange).toHaveBeenCalledWith("07:00")
);
// Start time should NOT be automatically adjusted when end time changes
expect(mockHandlers.onStartTimeChange).not.toHaveBeenCalled();
expect(mockHandlers.onStartDateChange).not.toHaveBeenCalled();
});
it("moves START backward properly when END date jumps before START date", async () => {
@@ -256,9 +256,21 @@ describe("DateTimeFields", () => {
const endDateInput = screen.getByTestId("end-date-input");
const endTimeInput = screen.getByTestId("end-time-input");
expect(startDateInput).toHaveAttribute("aria-label", "dateTimeFields.startDate");
expect(startTimeInput).toHaveAttribute("aria-label", "dateTimeFields.startTime");
expect(endDateInput).toHaveAttribute("aria-label", "dateTimeFields.endDate");
expect(endTimeInput).toHaveAttribute("aria-label", "dateTimeFields.endTime");
expect(startDateInput).toHaveAttribute(
"aria-label",
"dateTimeFields.startDate"
);
expect(startTimeInput).toHaveAttribute(
"aria-label",
"dateTimeFields.startTime"
);
expect(endDateInput).toHaveAttribute(
"aria-label",
"dateTimeFields.endDate"
);
expect(endTimeInput).toHaveAttribute(
"aria-label",
"dateTimeFields.endTime"
);
});
});