mirror of
https://github.com/langgenius/dify.git
synced 2026-05-02 16:38:04 +08:00
test: improve coverage for some files (#33218)
This commit is contained in:
@ -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()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user