diff --git a/src/components/@atoms/TextWithTooltip/TextWithTooltip.test.tsx b/src/components/@atoms/TextWithTooltip/TextWithTooltip.test.tsx new file mode 100644 index 000000000..3539227b5 --- /dev/null +++ b/src/components/@atoms/TextWithTooltip/TextWithTooltip.test.tsx @@ -0,0 +1,24 @@ +import { render, screen, userEvent } from '@app/test-utils' + +import { describe, expect, it } from 'vitest' + +import { TextWithTooltip } from './TextWithTooltip' + +describe('TextWithTooltip', () => { + it('should render tooltip', async () => { + render() + + const element = screen.getByTestId('tooltip') + await userEvent.hover(element) + expect(screen.getByText('tooltip-content')).toBeInTheDocument() + }) + + it('should render tooltip with link', async () => { + render() + + const element = screen.getByTestId('tooltip') + await userEvent.hover(element) + expect(screen.getByText('tooltip-content')).toBeInTheDocument() + expect(screen.getByRole('link')).toHaveAttribute('href', 'https://link.com') + }) +}) diff --git a/src/components/@atoms/TextWithTooltip/TextWithTooltip.tsx b/src/components/@atoms/TextWithTooltip/TextWithTooltip.tsx index ab9240428..dea24645e 100644 --- a/src/components/@atoms/TextWithTooltip/TextWithTooltip.tsx +++ b/src/components/@atoms/TextWithTooltip/TextWithTooltip.tsx @@ -63,7 +63,7 @@ export const TextWithTooltip = ({ } background="indigoSurface" > - + {children}