Skip to content

Commit

Permalink
chore: make test more strict #1985
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-mihok authored and mturoci committed Nov 20, 2023
1 parent d3a5dcd commit f9df1c9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ui/src/picker.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,15 +160,20 @@ describe('Picker.tsx', () => {
})

it('Filters correctly - does not offer already selected - without input provided', () => {
const { getByRole, queryByRole } = render(<XPicker model={pickerProps} />)
const { getByRole, queryByRole, getAllByRole } = render(<XPicker model={pickerProps} />)
const input = (getByRole('combobox') as HTMLInputElement)

fireEvent.click(input)
expect(getAllByRole('option')).toHaveLength(2)
typeToInput(input, name)
fireEvent.click(getByRole('option'))

fireEvent.click(input)
expect(getAllByRole('option')).toHaveLength(1)
typeToInput(input, altName)
fireEvent.click(getByRole('option'))
fireEvent.click(input)

fireEvent.click(input)
expect(queryByRole('option')?.querySelector('.ms-Suggestions-none')).toBeInTheDocument()
})

Expand Down

0 comments on commit f9df1c9

Please sign in to comment.