@@ -24,7 +24,7 @@ const parserOptions = {
24
24
const ruleTester = new RuleTester ( ) ;
25
25
26
26
const expectedError = {
27
- message : 'Emojis should be wrapped in <span>, have role="img", and have aria-label="Description of emoji" .' ,
27
+ message : 'Emojis should be wrapped in <span>, have role="img", and have an accessible description with aria-label or aria-labelledby .' ,
28
28
type : 'JSXOpeningElement' ,
29
29
} ;
30
30
@@ -35,13 +35,17 @@ ruleTester.run('accessible-emoji', rule, {
35
35
{ code : '<span>No emoji here!</span>' , parserOptions } ,
36
36
{ code : '<span role="img" aria-label="Panda face">🐼</span>' , parserOptions } ,
37
37
{ code : '<span role="img" aria-label="Snowman">☃</span>' , parserOptions } ,
38
+ { code : '<span role="img" aria-labelledby="id1">🐼</span>' , parserOptions } ,
39
+ { code : '<span role="img" aria-labelledby="id1">☃</span>' , parserOptions } ,
40
+ { code : '<span role="img" aria-labelledby="id1" aria-label="Snowman">☃</span>' , parserOptions } ,
38
41
{ code : '<span>{props.emoji}</span>' , parserOptions } ,
39
42
] ,
40
43
invalid : [
41
44
{ code : '<span>🐼</span>' , errors : [ expectedError ] , parserOptions } ,
42
45
{ code : '<span>foo🐼bar</span>' , errors : [ expectedError ] , parserOptions } ,
43
46
{ code : '<span>foo 🐼 bar</span>' , errors : [ expectedError ] , parserOptions } ,
44
47
{ code : '<i role="img" aria-label="Panda face">🐼</i>' , errors : [ expectedError ] , parserOptions } ,
48
+ { code : '<i role="img" aria-labelledby="id1">🐼</i>' , errors : [ expectedError ] , parserOptions } ,
45
49
{ code : '<Foo>🐼</Foo>' , errors : [ expectedError ] , parserOptions } ,
46
50
] ,
47
51
} ) ;
0 commit comments