[#72] show event duplicator in the event preview

This commit is contained in:
Camille Moussu
2025-09-11 15:37:32 +02:00
parent 48c17b1a0f
commit 7b5e03ac7e
3 changed files with 7 additions and 4 deletions
+5 -3
View File
@@ -3,6 +3,7 @@ import EventDuplication from "../../src/components/Event/EventDuplicate";
import EventDisplayModal from "../../src/features/Events/EventDisplay";
import EventPopover from "../../src/features/Events/EventModal";
import { renderWithProviders } from "../utils/Renderwithproviders";
import EventPreviewModal from "../../src/features/Events/EventDisplayPreview";
const day = new Date();
const preloadedState = {
@@ -153,11 +154,12 @@ describe("EventPopover", () => {
describe("EventDisplayModal", () => {
it("shows duplication button and opens duplication form", () => {
renderWithProviders(
<EventDisplayModal
<EventPreviewModal
eventId="event1"
calId="667037022b752d0026472254/cal1"
open={true}
onClose={jest.fn()}
anchorPosition={{ top: 0, left: 0 }}
/>,
preloadedState
);
@@ -165,10 +167,10 @@ describe("EventDisplayModal", () => {
fireEvent.click(screen.getByTestId("AddToPhotosIcon"));
expect(screen.getByText(/Duplicate Event/i)).toBeInTheDocument();
expect(
screen.getAllByDisplayValue(
screen.getByDisplayValue(
preloadedState.calendars.list["667037022b752d0026472254/cal1"].events
.event1.title
)
).toHaveLength(2);
).toBeInTheDocument();
});
});
-1
View File
@@ -244,7 +244,6 @@ export default function EventDisplayModal({
<Card sx={{ p: 2, position: "absolute" }}>
{/* Close button */}
<Box sx={{ position: "absolute", top: 8, right: 8 }}>
<EventDuplication event={event} onClose={onClose} />
<IconButton
size="small"
onClick={() => onClose({}, "backdropClick")}
@@ -39,6 +39,7 @@ import EventDisplayModal, {
} from "./EventDisplay";
import { getEvent } from "./EventApi";
import { CalendarEvent } from "./EventsTypes";
import EventDuplication from "../../components/Event/EventDuplicate";
export default function EventPreviewModal({
eventId,
@@ -122,6 +123,7 @@ export default function EventPreviewModal({
gap: 1,
}}
>
<EventDuplication event={event} onClose={onClose} />
{mailSpaUrl && attendees.length > 0 && (
<IconButton
size="small"