From 8dddb9a4e346ede616707ed7f424d2443856bdf5 Mon Sep 17 00:00:00 2001 From: Juan Castillo Date: Mon, 14 Oct 2024 20:31:27 -0700 Subject: [PATCH] CU: Remove hideArrow code from AccordionCollapsible (#9802) Co-authored-by: Therese <94404065+TKDickson@users.noreply.github.com> --- .../components/AccordionCollapsible.test.tsx | 10 ++-------- .../src/components/AccordionCollapsible.tsx | 19 +++---------------- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/VAMobile/src/components/AccordionCollapsible.test.tsx b/VAMobile/src/components/AccordionCollapsible.test.tsx index 61666ade009..f14d31bf5d7 100644 --- a/VAMobile/src/components/AccordionCollapsible.test.tsx +++ b/VAMobile/src/components/AccordionCollapsible.test.tsx @@ -9,11 +9,10 @@ import Mock = jest.Mock context('AccordionCollapsible', () => { let onPressSpy: Mock - const initializeTestInstance = (hideArrow = false, expandedInitialValue = false) => { + const initializeTestInstance = (expandedInitialValue = false) => { onPressSpy = jest.fn(() => {}) render( HEADER} expandedContent={EXPANDED} collapsedContent={COLLAPSED} @@ -43,13 +42,8 @@ context('AccordionCollapsible', () => { expect(onPressSpy).toBeCalled() }) - it('when hideArrow set to true, cannot find tab to press', () => { + it('when expandedInitialValue is true it should show Expanded and not Collapsed content on load', () => { initializeTestInstance(true) - expect(screen.queryByRole('tab')).toBeFalsy() - }) - - it('when expandedIntiailValue is true it should show Expanded and not Collapsed content on load', () => { - initializeTestInstance(false, true) expect(screen.getByRole('tab', { name: 'HEADER' })).toBeTruthy() expect(screen.queryByText('COLLAPSED')).toBeFalsy() expect(screen.getByText('EXPANDED')).toBeTruthy() diff --git a/VAMobile/src/components/AccordionCollapsible.tsx b/VAMobile/src/components/AccordionCollapsible.tsx index 5cbdcf9d1a2..f815fc516fc 100644 --- a/VAMobile/src/components/AccordionCollapsible.tsx +++ b/VAMobile/src/components/AccordionCollapsible.tsx @@ -22,8 +22,6 @@ export type AccordionCollapsibleProps = { a11yHint?: string /** component to display on when the accordion is collapsed */ collapsedContent?: ReactNode - /** if true hides the accordion arrow and only displays header & collapsed content */ - hideArrow?: boolean /** custom on press call if more action is needed when expanding/collapsing the accordion */ customOnPress?: (expandedValue?: boolean) => void /** sets the initial value of expanded if an accordion should already be expanded on render */ @@ -41,7 +39,6 @@ const AccordionCollapsible: FC = ({ header, expandedContent, collapsedContent, - hideArrow, testID, customOnPress, expandedInitialValue, @@ -78,11 +75,9 @@ const AccordionCollapsible: FC = ({ const data = ( {header} - {!hideArrow && ( - - - - )} + + + ) @@ -92,14 +87,6 @@ const AccordionCollapsible: FC = ({ } : {} - if (hideArrow) { - return ( - - {data} - - ) - } - return ( {data}