import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { describe, it, expect, vi } from 'vitest'; import { ExercisePicker } from '../src/pages/plans/plan-editor/ExercisePicker'; import type { Exercise } from '../src/api/types'; const LONG_NAME = 'Prostowanie przedramion w pionie ze sztangą trzymaną oburącz'; const EXERCISE = { id: 'ex-1', name: LONG_NAME, primaryMuscle: 'core', } as Exercise; describe('ExercisePicker — długa nazwa ćwiczenia', () => { it('nazwa w listboxie łamie się zamiast być przycinana', async () => { const user = userEvent.setup(); render(); await user.click(screen.getByRole('button', { name: 'dodaj ćwiczenie…' })); expect(await screen.findByRole('option', { name: LONG_NAME })).toBeInTheDocument(); const name = screen.getByText(LONG_NAME); expect(name).toHaveClass('break-words'); expect(name).not.toHaveClass('truncate'); }); });