Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
khiga8 committed Jul 17, 2023
1 parent 9bd7c06 commit c485717
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/a11y-role-supports-aria-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ ruleTester.run('a11y-role-supports-aria-props', rule, {
{code: '<div role="presentation" {...props} />'},
{code: '<Foo.Bar baz={true} />'},
{code: '<Link href="#" aria-checked />'},
// Don't try to evaluate expression
{code: '<Box aria-labelledby="some-id" role={role} />'},
{code: '<Box aria-labelledby="some-id"as={isNavigationOpen ? "div" : "nav"} />'},

Expand Down Expand Up @@ -481,12 +482,17 @@ ruleTester.run('a11y-role-supports-aria-props', rule, {
errors: [getErrorMessage('aria-labelledby', 'generic')],
},
{
code: '<div aria-label />',
errors: [getErrorMessage('aria-label', 'generic')],
code: '<div aria-labelledby />',
errors: [getErrorMessage('aria-labelledby', 'generic')],
},
// Determines role from literal `as` prop.
{
code: '<div aria-labelledby />',
code: '<Box as="span" aria-labelledby />',
errors: [getErrorMessage('aria-labelledby', 'generic')],
},
{
code: '<p role="generic" aria-label />',
errors: [getErrorMessage('aria-label', 'generic')],
},
],
})

0 comments on commit c485717

Please sign in to comment.