From cdaed8a7c141f142bae3eb35b7c78e58ad8c35b6 Mon Sep 17 00:00:00 2001 From: Camille Moussu <66134347+Eriikah@users.noreply.github.com> Date: Mon, 27 Oct 2025 11:41:35 +0100 Subject: [PATCH] [#254] fixed regression on other calendar display while no calendar available (#257) Co-authored-by: Camille Moussu --- __test__/components/CalendarSelection.test.tsx | 4 ++-- src/components/Calendar/CalendarSelection.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__test__/components/CalendarSelection.test.tsx b/__test__/components/CalendarSelection.test.tsx index c619964..4ac36c9 100644 --- a/__test__/components/CalendarSelection.test.tsx +++ b/__test__/components/CalendarSelection.test.tsx @@ -204,7 +204,7 @@ describe("CalendarSelection", () => { expect(screen.getByText("Browse other calendars")).toBeInTheDocument(); }); - it("renders only personal calendars if no delegated/other exist", () => { + it("when only personnal calendars are in the state, only personnal calendars and the title for other to be added are shown", () => { renderWithProviders( { expect(screen.getByText("Personnal Calendars")).toBeInTheDocument(); expect(screen.queryByText("Delegated Calendars")).not.toBeInTheDocument(); - expect(screen.queryByText("Other Calendars")).not.toBeInTheDocument(); + expect(screen.queryByText("Other Calendars")).toBeInTheDocument(); }); it("renders nothing when no calendars are present", () => { diff --git a/src/components/Calendar/CalendarSelection.tsx b/src/components/Calendar/CalendarSelection.tsx index 2454ae5..272f4aa 100644 --- a/src/components/Calendar/CalendarSelection.tsx +++ b/src/components/Calendar/CalendarSelection.tsx @@ -38,7 +38,7 @@ function CalendarAccordion({ const allCalendars = useAppSelector((state) => state.calendars.list); const [expended, setExpended] = useState(defaultExpanded); - if (calendars.length === 0 && !defaultExpanded) return null; + if (calendars.length === 0 && !showAddButton) return null; return (