@@ -36,6 +36,7 @@ ruleTester.run('a11y-role-supports-aria-props', rule, {
36
36
{ code : '<div role="presentation" {...props} />' } ,
37
37
{ code : '<Foo.Bar baz={true} />' } ,
38
38
{ code : '<Link href="#" aria-checked />' } ,
39
+ // Don't try to evaluate expression
39
40
{ code : '<Box aria-labelledby="some-id" role={role} />' } ,
40
41
{ code : '<Box aria-labelledby="some-id"as={isNavigationOpen ? "div" : "nav"} />' } ,
41
42
@@ -481,12 +482,17 @@ ruleTester.run('a11y-role-supports-aria-props', rule, {
481
482
errors : [ getErrorMessage ( 'aria-labelledby' , 'generic' ) ] ,
482
483
} ,
483
484
{
484
- code : '<div aria-label />' ,
485
- errors : [ getErrorMessage ( 'aria-label ' , 'generic' ) ] ,
485
+ code : '<div aria-labelledby />' ,
486
+ errors : [ getErrorMessage ( 'aria-labelledby ' , 'generic' ) ] ,
486
487
} ,
488
+ // Determines role from literal `as` prop.
487
489
{
488
- code : '<div aria-labelledby />' ,
490
+ code : '<Box as="span" aria-labelledby />' ,
489
491
errors : [ getErrorMessage ( 'aria-labelledby' , 'generic' ) ] ,
490
492
} ,
493
+ {
494
+ code : '<p role="generic" aria-label />' ,
495
+ errors : [ getErrorMessage ( 'aria-label' , 'generic' ) ] ,
496
+ } ,
491
497
] ,
492
498
} )
0 commit comments