[#254] fixed regression on other calendar display while no calendar available (#257)

Co-authored-by: Camille Moussu <cmoussu@linagora.com>
This commit is contained in:
Camille Moussu
2025-10-27 11:41:35 +01:00
committed by GitHub
parent 42f5d8e1a9
commit cdaed8a7c1
2 changed files with 3 additions and 3 deletions
@@ -204,7 +204,7 @@ describe("CalendarSelection", () => {
expect(screen.getByText("Browse other calendars")).toBeInTheDocument(); 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( renderWithProviders(
<CalendarSelection <CalendarSelection
selectedCalendars={[]} selectedCalendars={[]}
@@ -223,7 +223,7 @@ describe("CalendarSelection", () => {
expect(screen.getByText("Personnal Calendars")).toBeInTheDocument(); expect(screen.getByText("Personnal Calendars")).toBeInTheDocument();
expect(screen.queryByText("Delegated Calendars")).not.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", () => { it("renders nothing when no calendars are present", () => {
@@ -38,7 +38,7 @@ function CalendarAccordion({
const allCalendars = useAppSelector((state) => state.calendars.list); const allCalendars = useAppSelector((state) => state.calendars.list);
const [expended, setExpended] = useState(defaultExpanded); const [expended, setExpended] = useState(defaultExpanded);
if (calendars.length === 0 && !defaultExpanded) return null; if (calendars.length === 0 && !showAddButton) return null;
return ( return (
<Accordion <Accordion