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