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..f1c366795c 100644 --- a/src/components/__tests__/ListAccordion.test.tsx +++ b/src/components/__tests__/ListAccordion.test.tsx @@ -2,7 +2,7 @@ import { StyleSheet, View } from 'react-native'; import { describe, expect, it } from '@jest/globals'; -import { render, screen } from '../../test-utils'; +import { render, screen, within } from '../../test-utils'; import { red500 } from '../../theme/colors'; import { LightTheme } from '../../theme/schemes'; import ListAccordion from '../List/ListAccordion'; @@ -150,6 +150,35 @@ describe('ListAccordion', () => { }); }); +describe('ListAccordionGroup', () => { + it('expands the accordion with id={0} and keeps id={1} collapsed when expandedId={0}', async () => { + await render( + + + + + + + + + ); + + expect( + within(screen.getByRole('button', { expanded: true })).getByText( + 'Accordion 0' + ) + ).toBeOnTheScreen(); + expect(screen.getByText('Item 0')).toBeOnTheScreen(); + + expect( + within(screen.getByRole('button', { expanded: false })).getByText( + 'Accordion 1' + ) + ).toBeOnTheScreen(); + expect(screen.queryByText('Item 1')).not.toBeOnTheScreen(); + }); +}); + describe('getAccordionColors - description color', () => { it('should return theme color, for theme version 3', () => { expect(