test: improve coverage for some files (#33218)

This commit is contained in:
Saumya Talwani
2026-03-12 12:39:10 +05:30
committed by GitHub
parent 68982f910e
commit ed5511ce28
61 changed files with 3191 additions and 304 deletions

View File

@ -94,4 +94,21 @@ describe('SegmentedControl', () => {
const selectedOption = screen.getByText('Option 1').closest('button')?.closest('div')
expect(selectedOption).toHaveClass(customClass)
})
it('renders Icon when provided', () => {
const MockIcon = () => <svg data-testid="mock-icon" />
const optionsWithIcon = [
{ value: 'option1', text: 'Option 1', Icon: MockIcon },
]
render(<SegmentedControl options={optionsWithIcon} value="option1" onChange={onSelectMock} />)
expect(screen.getByTestId('mock-icon')).toBeInTheDocument()
})
it('renders count when provided and size is large', () => {
const optionsWithCount = [
{ value: 'option1', text: 'Option 1', count: 42 },
]
render(<SegmentedControl options={optionsWithCount} value="option1" onChange={onSelectMock} size="large" />)
expect(screen.getByText('42')).toBeInTheDocument()
})
})