Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c485717

Browse files
committed
add tests
1 parent 9bd7c06 commit c485717

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/a11y-role-supports-aria-props.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ ruleTester.run('a11y-role-supports-aria-props', rule, {
3636
{code: '<div role="presentation" {...props} />'},
3737
{code: '<Foo.Bar baz={true} />'},
3838
{code: '<Link href="#" aria-checked />'},
39+
// Don't try to evaluate expression
3940
{code: '<Box aria-labelledby="some-id" role={role} />'},
4041
{code: '<Box aria-labelledby="some-id"as={isNavigationOpen ? "div" : "nav"} />'},
4142

@@ -481,12 +482,17 @@ ruleTester.run('a11y-role-supports-aria-props', rule, {
481482
errors: [getErrorMessage('aria-labelledby', 'generic')],
482483
},
483484
{
484-
code: '<div aria-label />',
485-
errors: [getErrorMessage('aria-label', 'generic')],
485+
code: '<div aria-labelledby />',
486+
errors: [getErrorMessage('aria-labelledby', 'generic')],
486487
},
488+
// Determines role from literal `as` prop.
487489
{
488-
code: '<div aria-labelledby />',
490+
code: '<Box as="span" aria-labelledby />',
489491
errors: [getErrorMessage('aria-labelledby', 'generic')],
490492
},
493+
{
494+
code: '<p role="generic" aria-label />',
495+
errors: [getErrorMessage('aria-label', 'generic')],
496+
},
491497
],
492498
})

0 commit comments

Comments
 (0)