diff --git a/packages/dnb-eufemia/src/components/icon/__tests__/Icon.test.tsx b/packages/dnb-eufemia/src/components/icon/__tests__/Icon.test.tsx index a5c4b29b0cc..55304c24f83 100644 --- a/packages/dnb-eufemia/src/components/icon/__tests__/Icon.test.tsx +++ b/packages/dnb-eufemia/src/components/icon/__tests__/Icon.test.tsx @@ -122,6 +122,23 @@ describe('Icon component', () => { ).toBe('custom-data-testid-value') }) + it('should work when icon property is provided a functional component with a hook', () => { + const FunctionalComponentWithHookIcon = () => { + const [title] = React.useState('banana') + + return ( + + {title} + + + ) + } + render( + + ) + expect(document.querySelector('svg title').textContent).toBe('banana') + }) + it('should validate with ARIA rules', async () => { const Comp = render() expect(await axeComponent(Comp)).toHaveNoViolations()