This repository was archived by the owner on Sep 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
packages/chakra-ui-core/src/CCloseButton/tests Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
import CloseButton from '../'
2
- import { render } from '@/tests/test-utils'
2
+ import { render , screen } from '@/tests/test-utils'
3
3
4
4
const renderComponent = ( props ) => {
5
5
const base = {
@@ -14,18 +14,18 @@ it('should render correctly', () => {
14
14
expect ( asFragment ( ) ) . toMatchSnapshot ( )
15
15
} )
16
16
it ( 'should allow setting a custom aria-label for the button' , ( ) => {
17
- const { container } = renderComponent ( { template : '<CloseButton aria-label="my aria label" />' } )
17
+ renderComponent ( { template : '<CloseButton aria-label="my aria label" />' } )
18
18
19
- expect ( container . querySelector ( 'button ') ) . toHaveAttribute (
19
+ expect ( screen . getByLabelText ( 'my aria label ') ) . toHaveAttribute (
20
20
'aria-label' ,
21
21
'my aria label'
22
22
)
23
23
} )
24
24
25
25
test ( 'a11y - should have aria-label set to "Close"' , ( ) => {
26
- const { container } = renderComponent ( )
26
+ renderComponent ( )
27
27
28
- expect ( container . querySelector ( 'button ') ) . toHaveAttribute (
28
+ expect ( screen . getByLabelText ( 'Close ') ) . toHaveAttribute (
29
29
'aria-label' ,
30
30
'Close'
31
31
)
You can’t perform that action at this time.
0 commit comments