diff --git a/src/packages/components/tree/index.tsx b/src/packages/components/tree/index.tsx index ab5406d25..88d6634ab 100644 --- a/src/packages/components/tree/index.tsx +++ b/src/packages/components/tree/index.tsx @@ -21,7 +21,9 @@ export const Tree = ({ treeData, canDrag, linkPath }: TreeTypes) => { canDrop={() => false} generateNodeProps={(rowInfo) => ({ buttons: [ - {rowInfo.node.label}, + + {rowInfo.node.label} + , ], })} /> diff --git a/src/packages/modules-structures/components/collapsible-panel/collapsible-panel.spec.js b/src/packages/modules-structures/components/collapsible-panel/collapsible-panel.spec.js index 70afba156..9ab974fed 100644 --- a/src/packages/modules-structures/components/collapsible-panel/collapsible-panel.spec.js +++ b/src/packages/modules-structures/components/collapsible-panel/collapsible-panel.spec.js @@ -1,9 +1,20 @@ import '@testing-library/jest-dom'; -import { render, fireEvent } from '@testing-library/react'; +import { render, fireEvent, screen } from '@testing-library/react'; import { CollapsiblePanel } from '.'; describe('Collapsible Panel', () => { + it('should display children content', () => { + render( + + Children + + ); + const div = screen.getByText('Children'); + expect(div.getAttribute('hidden')).toBeFalsy(); + expect(div.getAttribute('aria-labelledby')).toBe('idbutton'); + expect(div.id).toBe('idbody'); + }); it('should not be collapsible', () => { const { container } = render( diff --git a/src/packages/modules-structures/components/collapsible-panel/index.js b/src/packages/modules-structures/components/collapsible-panel/index.tsx similarity index 79% rename from src/packages/modules-structures/components/collapsible-panel/index.js rename to src/packages/modules-structures/components/collapsible-panel/index.tsx index 2b0d7d3e3..79f34871e 100644 --- a/src/packages/modules-structures/components/collapsible-panel/index.js +++ b/src/packages/modules-structures/components/collapsible-panel/index.tsx @@ -1,13 +1,19 @@ -import { useState, useCallback } from 'react'; +import { useState, useCallback, PropsWithChildren } from 'react'; import { Note } from '@inseefr/wilco'; +type CollapsiblePanelTypes = { + id: string; + title: any; + hidden?: boolean; + collapsible?: boolean; +}; export const CollapsiblePanel = ({ id, title, children, hidden: hiddenProps, collapsible = true, -}) => { +}: Readonly>) => { const [hidden, setHidden] = useState(hiddenProps); const clickTitleHandler = useCallback(() => { setHidden(!hidden);