Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/__tests__/components/EventPopup.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe("EventPopup", () => {
expect(container.firstChild).toBeNull();
});

it("renders event details, resource links, and calendar creator", () => {
it("renders event details without session links, resources, or time", () => {
const onClose = jest.fn();
const date = dayjs("2025-01-14");

Expand All @@ -98,15 +98,18 @@ describe("EventPopup", () => {
).toContain("is-open");
expect(popupNode?.style.width).toBeTruthy();
expect(screen.getByText("Full Event Title")).toBeInTheDocument();
expect(screen.getByText("10:00 - 11:00")).toBeInTheDocument();
expect(screen.getByText("تاریخ شمسی")).toBeInTheDocument();
expect(screen.getByText("تاریخ میلادی")).toBeInTheDocument();
expect(container.querySelector(".event-popup__link--primary")).toBe(
container.querySelector(`a[href="https://example.com/session"]`)
);
expect(
container.querySelector(`a[href="https://example.com/resource"]`)
).toBeInTheDocument();
).not.toBeInTheDocument();
expect(
container.querySelector(`a[href="https://example.com/session"]`)
).not.toBeInTheDocument();
expect(screen.queryByText("10:00 - 11:00")).not.toBeInTheDocument();
expect(screen.queryByText("لینک جلسه")).not.toBeInTheDocument();
expect(screen.queryByText("منبع")).not.toBeInTheDocument();
expect(screen.queryByText("زمان")).not.toBeInTheDocument();

const dot = container.querySelector(".event-popup__color-dot");
expect(dot?.style.background).toContain("34");
Expand Down Expand Up @@ -152,7 +155,10 @@ describe("EventPopup", () => {

jest.runAllTimers();

expect(getByText("ساعت ۱۸:۰۰ تا ۱۹:۰۰")).toBeInTheDocument();
expect(getByText("تاریخ شمسی")).toBeInTheDocument();
expect(
screen.queryByText("ساعت ۱۸:۰۰ تا ۱۹:۰۰")
).not.toBeInTheDocument();
expect(
screen.queryByTestId("calendar-event-creator")
).not.toBeInTheDocument();
Expand Down
41 changes: 0 additions & 41 deletions src/components/EventPopup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,50 +164,9 @@ const EventPopup = ({ visible, anchorRect, date, event, onClose }) => {
{event.fullName || event.title}
</div>
</div>

{event.link && (
<div className="event-popup__row">
<div className="event-popup__label">
لینک جلسه
</div>
<div className="event-popup__value">
<a
href={event.link}
target="_blank"
rel="noreferrer"
className="event-popup__link event-popup__link--primary"
>
{"ماکروسافت تیمز"}
</a>
</div>
</div>
)}

{event.resource && (
<div className="event-popup__row">
<div className="event-popup__label">منبع</div>
<div className="event-popup__value">
<a
href={event.resource}
target="_blank"
rel="noreferrer"
className="event-popup__link"
>
{"مشاهده منبع"}
</a>
</div>
</div>
)}
</>
)}

<div className="event-popup__row">
<div className="event-popup__label">زمان</div>
<div className="event-popup__value">
{event?.time || "ساعت ۱۸:۰۰ تا ۱۹:۰۰"}
</div>
</div>

{date && event && (
<div className="event-popup__creator">
<CalendarEventCreator
Expand Down
Loading