Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
@@ -213,7 +213,7 @@ describe("Repeat Event Integration Tests", () => {
|
|||||||
fireEvent.click(dailyOption);
|
fireEvent.click(dailyOption);
|
||||||
|
|
||||||
await expectRRule({ freq: "daily", interval: 1 });
|
await expectRRule({ freq: "daily", interval: 1 });
|
||||||
expect(mockOnClose).toHaveBeenCalledWith({}, "backdropClick");
|
expect(mockOnClose).toHaveBeenCalledWith(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("sends correct API payload for repeat daily with 2 day interval", async () => {
|
it("sends correct API payload for repeat daily with 2 day interval", async () => {
|
||||||
@@ -224,7 +224,7 @@ describe("Repeat Event Integration Tests", () => {
|
|||||||
fireEvent.change(intervalInput, { target: { value: "2" } });
|
fireEvent.change(intervalInput, { target: { value: "2" } });
|
||||||
|
|
||||||
await expectRRule({ freq: "daily", interval: 2 });
|
await expectRRule({ freq: "daily", interval: 2 });
|
||||||
expect(mockOnClose).toHaveBeenCalledWith({}, "backdropClick");
|
expect(mockOnClose).toHaveBeenCalledWith(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("sends correct API payload for repeat daily for 5 repetitions", async () => {
|
it("sends correct API payload for repeat daily for 5 repetitions", async () => {
|
||||||
@@ -239,7 +239,7 @@ describe("Repeat Event Integration Tests", () => {
|
|||||||
fireEvent.change(occurrencesInput, { target: { value: "5" } });
|
fireEvent.change(occurrencesInput, { target: { value: "5" } });
|
||||||
|
|
||||||
await expectRRule({ freq: "daily", interval: 1, occurrences: 5 });
|
await expectRRule({ freq: "daily", interval: 1, occurrences: 5 });
|
||||||
expect(mockOnClose).toHaveBeenCalledWith({}, "backdropClick");
|
expect(mockOnClose).toHaveBeenCalledWith(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("sends correct API payload for repeat daily until specific date", async () => {
|
it("sends correct API payload for repeat daily until specific date", async () => {
|
||||||
@@ -256,7 +256,7 @@ describe("Repeat Event Integration Tests", () => {
|
|||||||
fireEvent.change(endDateInput, { target: { value: "2025-12-31" } });
|
fireEvent.change(endDateInput, { target: { value: "2025-12-31" } });
|
||||||
|
|
||||||
await expectRRule({ freq: "daily", interval: 1, endDate: "2025-12-31" });
|
await expectRRule({ freq: "daily", interval: 1, endDate: "2025-12-31" });
|
||||||
expect(mockOnClose).toHaveBeenCalledWith({}, "backdropClick");
|
expect(mockOnClose).toHaveBeenCalledWith(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("sends correct API payload for repeat weekly on specific days", async () => {
|
it("sends correct API payload for repeat weekly on specific days", async () => {
|
||||||
@@ -281,7 +281,7 @@ describe("Repeat Event Integration Tests", () => {
|
|||||||
interval: 1,
|
interval: 1,
|
||||||
byday: ["FR", "TH"],
|
byday: ["FR", "TH"],
|
||||||
});
|
});
|
||||||
expect(mockOnClose).toHaveBeenCalledWith({}, "backdropClick");
|
expect(mockOnClose).toHaveBeenCalledWith(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("sends correct API payload for repeat weekly with 3 week interval", async () => {
|
it("sends correct API payload for repeat weekly with 3 week interval", async () => {
|
||||||
@@ -300,7 +300,7 @@ describe("Repeat Event Integration Tests", () => {
|
|||||||
fireEvent.change(intervalInput, { target: { value: "3" } });
|
fireEvent.change(intervalInput, { target: { value: "3" } });
|
||||||
|
|
||||||
await expectRRule({ freq: "weekly", interval: 3 });
|
await expectRRule({ freq: "weekly", interval: 3 });
|
||||||
expect(mockOnClose).toHaveBeenCalledWith({}, "backdropClick");
|
expect(mockOnClose).toHaveBeenCalledWith(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("sends correct API payload for repeat monthly", async () => {
|
it("sends correct API payload for repeat monthly", async () => {
|
||||||
@@ -315,7 +315,7 @@ describe("Repeat Event Integration Tests", () => {
|
|||||||
fireEvent.click(monthlyOption);
|
fireEvent.click(monthlyOption);
|
||||||
|
|
||||||
await expectRRule({ freq: "monthly", interval: 1 });
|
await expectRRule({ freq: "monthly", interval: 1 });
|
||||||
expect(mockOnClose).toHaveBeenCalledWith({}, "backdropClick");
|
expect(mockOnClose).toHaveBeenCalledWith(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("sends correct API payload for repeat monthly and end after 5 occurrences", async () => {
|
it("sends correct API payload for repeat monthly and end after 5 occurrences", async () => {
|
||||||
@@ -338,7 +338,7 @@ describe("Repeat Event Integration Tests", () => {
|
|||||||
fireEvent.change(occurrencesInput, { target: { value: "5" } });
|
fireEvent.change(occurrencesInput, { target: { value: "5" } });
|
||||||
|
|
||||||
await expectRRule({ freq: "monthly", interval: 1, occurrences: 5 });
|
await expectRRule({ freq: "monthly", interval: 1, occurrences: 5 });
|
||||||
expect(mockOnClose).toHaveBeenCalledWith({}, "backdropClick");
|
expect(mockOnClose).toHaveBeenCalledWith(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("sends correct API payload for repeat yearly", async () => {
|
it("sends correct API payload for repeat yearly", async () => {
|
||||||
@@ -353,7 +353,7 @@ describe("Repeat Event Integration Tests", () => {
|
|||||||
fireEvent.click(yearlyOption);
|
fireEvent.click(yearlyOption);
|
||||||
|
|
||||||
await expectRRule({ freq: "yearly", interval: 1 });
|
await expectRRule({ freq: "yearly", interval: 1 });
|
||||||
expect(mockOnClose).toHaveBeenCalledWith({}, "backdropClick");
|
expect(mockOnClose).toHaveBeenCalledWith(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("sends correct API payload for repeat yearly with end option changes", async () => {
|
it("sends correct API payload for repeat yearly with end option changes", async () => {
|
||||||
@@ -383,6 +383,6 @@ describe("Repeat Event Integration Tests", () => {
|
|||||||
occurrences: 0,
|
occurrences: 0,
|
||||||
endDate: "",
|
endDate: "",
|
||||||
});
|
});
|
||||||
expect(mockOnClose).toHaveBeenCalledWith({}, "backdropClick");
|
expect(mockOnClose).toHaveBeenCalledWith(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -314,10 +314,10 @@ describe("EventPopover", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// onClose should be called
|
// onClose should be called
|
||||||
expect(mockOnClose).toHaveBeenCalledWith({}, "backdropClick");
|
expect(mockOnClose).toHaveBeenCalledWith(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("calls onClose when Cancel clicked", () => {
|
it("calls onClose with refresh = false when Cancel clicked", () => {
|
||||||
renderPopover();
|
renderPopover();
|
||||||
|
|
||||||
// Cancel button only appears in expanded mode
|
// Cancel button only appears in expanded mode
|
||||||
@@ -325,7 +325,7 @@ describe("EventPopover", () => {
|
|||||||
|
|
||||||
fireEvent.click(screen.getByRole("button", { name: /Cancel/i }));
|
fireEvent.click(screen.getByRole("button", { name: /Cancel/i }));
|
||||||
|
|
||||||
expect(mockOnClose).toHaveBeenCalledWith({}, "backdropClick");
|
expect(mockOnClose).toHaveBeenCalledWith(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("BUGFIX: Prefill Calendar field", async () => {
|
it("BUGFIX: Prefill Calendar field", async () => {
|
||||||
|
|||||||
@@ -86,33 +86,35 @@ export const createEventHandlers = (props: EventHandlersProps) => {
|
|||||||
setAnchorEl(document.body);
|
setAnchorEl(document.body);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClosePopover = () => {
|
const handleClosePopover = (refresh?: boolean) => {
|
||||||
calendarRef.current?.unselect();
|
calendarRef.current?.unselect();
|
||||||
setAnchorEl(null);
|
setAnchorEl(null);
|
||||||
setSelectedRange(null);
|
setSelectedRange(null);
|
||||||
selectedCalendars.forEach((calId) =>
|
if (refresh) {
|
||||||
dispatch(
|
selectedCalendars.forEach((calId) =>
|
||||||
getCalendarDetailAsync({
|
dispatch(
|
||||||
calId,
|
getCalendarDetailAsync({
|
||||||
match: {
|
calId,
|
||||||
start: formatDateToYYYYMMDDTHHMMSS(calendarRange.start),
|
match: {
|
||||||
end: formatDateToYYYYMMDDTHHMMSS(calendarRange.end),
|
start: formatDateToYYYYMMDDTHHMMSS(calendarRange.start),
|
||||||
},
|
end: formatDateToYYYYMMDDTHHMMSS(calendarRange.end),
|
||||||
})
|
},
|
||||||
)
|
})
|
||||||
);
|
)
|
||||||
Object.keys(tempcalendars).forEach((calId) =>
|
);
|
||||||
dispatch(
|
Object.keys(tempcalendars).forEach((calId) =>
|
||||||
getCalendarDetailAsync({
|
dispatch(
|
||||||
calId,
|
getCalendarDetailAsync({
|
||||||
match: {
|
calId,
|
||||||
start: formatDateToYYYYMMDDTHHMMSS(calendarRange.start),
|
match: {
|
||||||
end: formatDateToYYYYMMDDTHHMMSS(calendarRange.end),
|
start: formatDateToYYYYMMDDTHHMMSS(calendarRange.start),
|
||||||
},
|
end: formatDateToYYYYMMDDTHHMMSS(calendarRange.end),
|
||||||
calType: "temp",
|
},
|
||||||
})
|
calType: "temp",
|
||||||
)
|
})
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCloseEventDisplay = () => {
|
const handleCloseEventDisplay = () => {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ function EventPopover({
|
|||||||
}: {
|
}: {
|
||||||
anchorEl: HTMLElement | null;
|
anchorEl: HTMLElement | null;
|
||||||
open: boolean;
|
open: boolean;
|
||||||
onClose: (event: {}, reason: "backdropClick" | "escapeKeyDown") => void;
|
onClose: (refresh?: boolean) => void;
|
||||||
selectedRange: DateSelectArg | null;
|
selectedRange: DateSelectArg | null;
|
||||||
setSelectedRange: Function;
|
setSelectedRange: Function;
|
||||||
calendarRef: React.RefObject<CalendarApi | null>;
|
calendarRef: React.RefObject<CalendarApi | null>;
|
||||||
@@ -564,7 +564,7 @@ function EventPopover({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
onClose({}, "backdropClick");
|
onClose(false);
|
||||||
setShowValidationErrors(false);
|
setShowValidationErrors(false);
|
||||||
resetAllStateToDefault();
|
resetAllStateToDefault();
|
||||||
setStart("");
|
setStart("");
|
||||||
@@ -656,7 +656,7 @@ function EventPopover({
|
|||||||
setShowValidationErrors(false);
|
setShowValidationErrors(false);
|
||||||
|
|
||||||
// Close popup immediately
|
// Close popup immediately
|
||||||
onClose({}, "backdropClick");
|
onClose(true);
|
||||||
|
|
||||||
// Reset all state to default values
|
// Reset all state to default values
|
||||||
resetAllStateToDefault();
|
resetAllStateToDefault();
|
||||||
|
|||||||
Reference in New Issue
Block a user