From efe36c9c9d61f88f951768536870279d7f1065b3 Mon Sep 17 00:00:00 2001 From: Raphael Fakhri <153192858+RaphaelFakhri@users.noreply.github.com> Date: Sun, 25 Oct 2026 06:36:35 +0000 Subject: [PATCH] fix(list): expand accordion with id 0 in a controlled AccordionGroup --- src/components/List/ListAccordionGroup.tsx | 2 +- src/components/__tests__/ListAccordion.test.tsx | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/List/ListAccordionGroup.tsx b/src/components/List/ListAccordionGroup.tsx index 15e148ae6e..f153eb557f 100644 --- a/src/components/List/ListAccordionGroup.tsx +++ b/src/components/List/ListAccordionGroup.tsx @@ -74,7 +74,7 @@ const ListAccordionGroup = ({ return ( diff --git a/src/components/__tests__/ListAccordion.test.tsx b/src/components/__tests__/ListAccordion.test.tsx index ce387e343a..4d594e7bd0 100644 --- a/src/components/__tests__/ListAccordion.test.tsx +++ b/src/components/__tests__/ListAccordion.test.tsx @@ -135,6 +135,22 @@ describe('ListAccordion', () => { await expect(render()).resolves.toBeDefined(); }); + it('expands the accordion with id={0} when it is the controlled expandedId', async () => { + await render( + {}}> + + + + + + + + ); + + expect(screen.getByText('First accordion item')).toBeOnTheScreen(); + expect(screen.queryByText('Second accordion item')).not.toBeOnTheScreen(); + }); + it('should throw an error when id={""}', async () => { const ListAccordionTest = () => (