Skip to content

Commit

Permalink
fix(errormessage): check data is an array of IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoFiers committed Aug 5, 2018
1 parent 2cece25 commit d64bc5f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/checks/aria/errormessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function validateAttrValue() {
// limit results to elements that actually have this attribute
if (options.indexOf(attr) === -1 && hasAttr) {
if (!validateAttrValue()) {
this.data(attr);
this.data(axe.utils.tokenList(attr));
return false;
}
}
Expand Down
10 changes: 10 additions & 0 deletions test/checks/aria/errormessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ describe('aria-errormessage', function() {
);
});

it('sets an array of IDs in data', function() {
var testHTML = '<div></div>';
testHTML += '<div id="plain"></div>';
fixture.innerHTML = testHTML;
var target = fixture.children[0];
target.setAttribute('aria-errormessage', ' foo bar \tbaz ');
checks['aria-errormessage'].evaluate.call(checkContext, target);
assert.deepEqual(checkContext._data, ['foo', 'bar', 'baz']);
});

(shadowSupported ? it : xit)(
'should return false if aria-errormessage value crosses shadow boundary',
function() {
Expand Down

0 comments on commit d64bc5f

Please sign in to comment.