import { render, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import { describe, expect, it, vi } from 'vitest'
import { CardinalityZeroOrManyLeftIcon } from '../CardinalityZeroOrManyLeftIcon'
describe('CardinalityZeroOrManyLeftIcon', () => {
it('renders without crashing', () => {
render()
expect(screen.getByRole('img')).toBeInTheDocument()
})
it('applies custom color through style prop', () => {
render()
const svg = screen.getByRole('img')
expect(svg).toHaveStyle({ color: 'red' })
})
it('applies custom width and height', () => {
render()
const svg = screen.getByRole('img')
expect(svg).toHaveAttribute('width', '32')
expect(svg).toHaveAttribute('height', '32')
})
it('applies custom className', () => {
render()
const svg = screen.getByRole('img')
expect(svg).toHaveClass('custom-icon')
})
it('applies custom data attributes', () => {
render(
,
)
const svg = screen.getByRole('img')
expect(svg).toHaveAttribute(
'data-testid',
'cardinality-zero-or-many-left-icon',
)
})
it('applies custom onClick handler', async () => {
const user = userEvent.setup()
const handleClick = vi.fn()
render()
const svg = screen.getByRole('img')
await user.click(svg)
expect(handleClick).toHaveBeenCalledTimes(1)
})
})