@@ -47,6 +47,14 @@ const ignoreNonDOMSchema = [{
47
47
ignoreNonDOM : true ,
48
48
} ] ;
49
49
50
+ const customDivSettings = {
51
+ 'jsx-a11y' : {
52
+ components : {
53
+ Div : 'div' ,
54
+ } ,
55
+ } ,
56
+ } ;
57
+
50
58
ruleTester . run ( 'aria-role' , rule , {
51
59
valid : [
52
60
// Variables should pass, as we are only testing literals.
@@ -66,6 +74,11 @@ ruleTester.run('aria-role', rule, {
66
74
{ code : '<Foo role="bar" />' , options : ignoreNonDOMSchema } ,
67
75
{ code : '<fakeDOM role="bar" />' , options : ignoreNonDOMSchema } ,
68
76
{ code : '<img role="presentation" />' , options : ignoreNonDOMSchema } ,
77
+ {
78
+ code : '<Div role="button" />' ,
79
+ errors : [ errorMessage ] ,
80
+ settings : customDivSettings ,
81
+ } ,
69
82
] . concat ( validTests ) . map ( parserOptionsMapper ) ,
70
83
71
84
invalid : [
@@ -82,5 +95,12 @@ ruleTester.run('aria-role', rule, {
82
95
{ code : '<div role={null}></div>' , errors : [ errorMessage ] } ,
83
96
{ code : '<Foo role="datepicker" />' , errors : [ errorMessage ] } ,
84
97
{ code : '<Foo role="Button" />' , errors : [ errorMessage ] } ,
98
+ { code : '<Div role="Button" />' , errors : [ errorMessage ] , settings : customDivSettings } ,
99
+ {
100
+ code : '<Div role="Button" />' ,
101
+ errors : [ errorMessage ] ,
102
+ options : ignoreNonDOMSchema ,
103
+ settings : customDivSettings ,
104
+ } ,
85
105
] . concat ( invalidTests ) . map ( parserOptionsMapper ) ,
86
106
} ) ;
0 commit comments