Skip to content

Commit 4563e51

Browse files
Kzoepsjannikbuschke
authored andcommitted
chore(select): change to use functions from render instead of screen
1 parent 35d208a commit 4563e51

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/select/index.test.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Form } from '../form'
44
import Select from './index'
55
import '@testing-library/jest-dom/extend-expect'
66
import { act } from 'react-dom/test-utils'
7-
import { fireEvent, render, screen } from '@testing-library/react'
7+
import { fireEvent, render } from '@testing-library/react'
88

99
const TestSelect = () => {
1010
return (
@@ -21,8 +21,8 @@ const TestSelect = () => {
2121
}
2222

2323
test('renders select', async () => {
24-
render(<TestSelect/>)
25-
expect(screen.queryByRole('combobox')).toBeInTheDocument()
24+
const { queryByRole } = render(<TestSelect />)
25+
expect(queryByRole('combobox')).toBeInTheDocument()
2626
})
2727

2828
test('sets initial value', async () => {
@@ -31,12 +31,12 @@ test('sets initial value', async () => {
3131
})
3232

3333
test('changes selected upon clicking', async () => {
34-
const { getByRole, queryByText, getByText, queryAllByText } = render(<TestSelect/>)
34+
const { getByRole, queryByText, getByText, getAllByText } = render(<TestSelect/>)
3535
const selector = getByRole('combobox')
3636
expect(queryByText('Zero')).toBeInTheDocument()
3737
fireEvent.mouseDown(selector)
3838
await act(async () => {
3939
fireEvent.click(getByText('One'))
4040
})
41-
expect(queryAllByText('One').length).toBeGreaterThan(1)
41+
expect(getAllByText('One').length).toBeGreaterThan(1)
4242
})

0 commit comments

Comments
 (0)