test: improve coverage parameters for some files in base (#33207)

This commit is contained in:
Saumya Talwani
2026-03-12 12:27:31 +05:30
committed by GitHub
parent c43307dae1
commit 68982f910e
86 changed files with 7513 additions and 765 deletions

View File

@ -35,6 +35,11 @@ describe('PureSelect', () => {
render(<PureSelect options={options} multiple={true} value={['apple', 'banana']} />)
expect(screen.getByText(/selected/i)).toBeInTheDocument()
})
it('should render placeholder in multiple mode when selected values are empty', () => {
render(<PureSelect options={options} multiple={true} value={[]} placeholder="Pick fruits" />)
expect(screen.getByTitle('Pick fruits')).toBeInTheDocument()
})
})
// Interaction behavior in single and multiple selection modes.
@ -91,6 +96,23 @@ describe('PureSelect', () => {
expect(onChange).toHaveBeenCalledWith(['banana'])
})
it('should start with empty array when multiple value is undefined', async () => {
const user = userEvent.setup()
const onChange = vi.fn()
render(
<PureSelect
options={options}
multiple={true}
onChange={onChange}
containerProps={{ open: true }}
/>,
)
await user.click(screen.getAllByTitle('Apple')[0])
expect(onChange).toHaveBeenCalledWith(['apple'])
})
})
// Controlled open state and disabled behavior.