import { render, screen } from '../../test-utils'; import { ListItem, type ListItemProps } from '../ListItem'; const renderWithMedia = (media: ListItemProps['media']) => render(); describe('ListItem.Image', () => { it('renders image with presentation role when no alt text', () => { renderWithMedia(); expect(screen.getByRole('presentation')).toHaveAttribute('src', 'test-image.jpg'); }); it('renders image with img role when alt text provided', () => { renderWithMedia(); const image = screen.getByRole('img'); expect(image).toHaveAttribute('alt', 'Test image description'); expect(image).toHaveAttribute('src', 'test-image.jpg'); }); it('renders image with loading prop', () => { renderWithMedia(); expect(screen.getByRole('presentation')).toHaveAttribute('loading', 'lazy'); }); it('renders image with className prop', () => { renderWithMedia(); expect(screen.getByRole('presentation')).toHaveClass('custom-image-class'); }); });