File tree Expand file tree Collapse file tree 3 files changed +12
-11
lines changed
integration/rules/aria-valid-attr-value Expand file tree Collapse file tree 3 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -89,11 +89,7 @@ aria.validateAttrValue = function (node, attr) {
89
89
return true ;
90
90
}
91
91
list = axe . utils . tokenList ( value ) ;
92
- // Check if any value isn't in the list of values
93
- return list . reduce ( function ( result , token ) {
94
- return ! ! ( result && doc . getElementById ( token ) ) ;
95
- // Initial state, fail if the list is empty
96
- } , list . length !== 0 ) ;
92
+ return list . some ( ( token ) => doc . getElementById ( token ) ) ;
97
93
98
94
case 'string' :
99
95
// anything goes
Original file line number Diff line number Diff line change @@ -239,18 +239,23 @@ describe('aria.validateAttrValue', function () {
239
239
} ) ;
240
240
241
241
it ( 'should return false when a single referenced node is not found' , function ( ) {
242
-
243
242
node . setAttribute ( 'cats' , 'invalid' ) ;
244
243
// target2 not found
245
244
assert . isFalse ( axe . commons . aria . validateAttrValue ( node , 'cats' ) ) ;
246
245
} ) ;
247
246
248
- it ( 'should return false when a referenced element is not found' , function ( ) {
247
+ it ( 'should return false when at no referenced element is found' , function ( ) {
248
+ fixture . innerHTML = '<div id="target"></div>' ;
249
+ node . setAttribute ( 'cats' , 'target2 target3' ) ;
250
+ // target2 not found
251
+ assert . isFalse ( axe . commons . aria . validateAttrValue ( node , 'cats' ) ) ;
252
+ } ) ;
249
253
254
+ it ( 'should return true when at least one referenced element is found' , function ( ) {
250
255
fixture . innerHTML = '<div id="target"></div>' ;
251
256
node . setAttribute ( 'cats' , 'target target2' ) ;
252
257
// target2 not found
253
- assert . isFalse ( axe . commons . aria . validateAttrValue ( node , 'cats' ) ) ;
258
+ assert . isTrue ( axe . commons . aria . validateAttrValue ( node , 'cats' ) ) ;
254
259
} ) ;
255
260
256
261
it ( 'should return true when all targets are found' , function ( ) {
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ <h2>Possible False Positives</h2>
74
74
< div aria-controls =" ref ref2 " id ="pass22 "> hi</ div >
75
75
76
76
< div aria-describedby ="ref " id ="pass23 "> hi</ div >
77
- < div aria-describedby ="ref ref2 " id ="pass24 "> hi</ div >
77
+ < div aria-describedby ="ref ref2 failref " id ="pass24 "> hi</ div >
78
78
< div aria-describedby =" ref ref2 " id ="pass25 "> hi</ div >
79
79
80
80
< div aria-disabled ="true " id ="pass26 "> hi</ div >
@@ -117,7 +117,7 @@ <h2>Possible False Positives</h2>
117
117
< div aria-label ="stuff " id ="pass55 "> hi</ div >
118
118
119
119
< div aria-labelledby ="ref " id ="pass56 "> hi</ div >
120
- < div aria-labelledby ="ref ref2 " id ="pass57 "> hi</ div >
120
+ < div aria-labelledby ="ref ref2 failedref " id ="pass57 "> hi</ div >
121
121
< div aria-labelledby =" ref ref2 " id ="pass58 "> hi</ div >
122
122
123
123
< div aria-level ="0 " id ="pass59 "> hi</ div >
@@ -145,7 +145,7 @@ <h2>Possible False Positives</h2>
145
145
< div aria-orientation ="vertical " id ="pass76 "> hi</ div >
146
146
147
147
< div aria-owns ="ref " id ="pass77 "> hi</ div >
148
- < div aria-owns ="ref ref2 " id ="pass78 "> hi</ div >
148
+ < div aria-owns ="ref ref2 failedref " id ="pass78 "> hi</ div >
149
149
< div aria-owns =" ref ref2 " id ="pass79 "> hi</ div >
150
150
151
151
< div aria-posinset ="0 " id ="pass80 "> hi</ div >
You can’t perform that action at this time.
0 commit comments