This repository has been archived by the owner on Sep 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(UIKIT-1663,MenuItem): Добавлен note (#1082)
- Loading branch information
1 parent
a89ad66
commit cfa6dd0
Showing
4 changed files
with
119 additions
and
2 deletions.
There are no files selected for viewing
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
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
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,40 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import { renderWithTheme, screen, userEvents } from '@astral/tests'; | ||
|
||
import { MenuItem } from './MenuItem'; | ||
|
||
describe('MenuItem', () => { | ||
it('Tooltip отображается если передан note и disabled=false', async () => { | ||
const label = 'Мой профиль'; | ||
|
||
renderWithTheme(<MenuItem note="Перейти в профиль">{label}</MenuItem>); | ||
|
||
const item = screen.getByText(label); | ||
|
||
await userEvents.hover(item); | ||
|
||
const tooltip = await screen.findByRole('tooltip'); | ||
|
||
expect(tooltip).toBeVisible(); | ||
expect(tooltip).toHaveTextContent('Перейти в профиль'); | ||
}); | ||
|
||
it('Tooltip отображается если передан disabledReason и disabled=true', async () => { | ||
const label = 'Мой профиль'; | ||
|
||
renderWithTheme( | ||
<MenuItem disabled disabledReason="Заблокировано"> | ||
{label} | ||
</MenuItem>, | ||
); | ||
|
||
const item = screen.getByLabelText('Заблокировано'); | ||
|
||
await userEvents.hover(item); | ||
|
||
const tooltip = await screen.findByRole('tooltip'); | ||
|
||
expect(tooltip).toBeVisible(); | ||
expect(tooltip).toHaveTextContent('Заблокировано'); | ||
}); | ||
}); |
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