Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 4ad841f

Browse files
committed
test(progress): refactor use screen
1 parent 1dd4c68 commit 4ad841f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/chakra-ui-core/src/CProgress/tests/CProgress.test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CProgress, CProgressLabel } from '../..'
2-
import { render } from '@/tests/test-utils'
2+
import { render, screen } from '@/tests/test-utils'
33

44
const renderComponent = (props) => {
55
const base = {
@@ -19,31 +19,31 @@ it('should render correctly', () => {
1919
})
2020

2121
it('should have the correct width', () => {
22-
const { queryByRole } = renderComponent()
22+
renderComponent()
2323

24-
expect(queryByRole('progressbar')).toHaveStyle('width: 40%')
24+
expect(screen.queryByRole('progressbar')).toHaveStyle('width: 40%')
2525
})
2626

2727
it('should display a label', () => {
28-
const { queryByText } = renderComponent({
28+
renderComponent({
2929
template: `
3030
<CProgress :value="40">
3131
<CProgressLabel>Label</CProgressLabel>
3232
</CProgress>`
3333
})
3434

35-
expect(queryByText('Label')).toBeInTheDocument()
35+
expect(screen.queryByText('Label')).toBeInTheDocument()
3636
})
3737

3838
test('a11y - progress has a "role" set to "progressbar"', () => {
39-
const { queryByRole } = renderComponent()
40-
expect(queryByRole('progressbar')).toBeInTheDocument()
39+
renderComponent()
40+
expect(screen.queryByRole('progressbar')).toBeInTheDocument()
4141
})
4242

4343
test('a11y - progress has a "aria-valuenow" set to the percentage completion value', () => {
44-
const { queryByRole } = renderComponent()
44+
renderComponent()
4545

46-
expect(queryByRole('progressbar')).toHaveAttribute(
46+
expect(screen.queryByRole('progressbar')).toHaveAttribute(
4747
'aria-valuenow',
4848
'40'
4949
)

0 commit comments

Comments
 (0)