-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Stanislav Lysak
committed
Dec 3, 2024
1 parent
e3d028e
commit a8f7dfe
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
src/components/@atoms/TextWithTooltip/TextWithTooltip.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(<TextWithTooltip tooltipContent="tooltip-content" />) | ||
|
||
const element = screen.getByTestId('tooltip') | ||
await userEvent.hover(element) | ||
expect(screen.getByText('tooltip-content')).toBeInTheDocument() | ||
}) | ||
|
||
it('should render tooltip with link', async () => { | ||
render(<TextWithTooltip tooltipContent="tooltip-content" link="https://link.com" />) | ||
|
||
const element = screen.getByTestId('tooltip') | ||
await userEvent.hover(element) | ||
expect(screen.getByText('tooltip-content')).toBeInTheDocument() | ||
expect(screen.getByRole('link')).toHaveAttribute('href', 'https://link.com') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters