From d64bc5fc4692cf0ca0b269fe7027fef61adf0eb0 Mon Sep 17 00:00:00 2001 From: Wilco Fiers Date: Sun, 5 Aug 2018 19:02:42 +0200 Subject: [PATCH] fix(errormessage): check data is an array of IDs --- lib/checks/aria/errormessage.js | 2 +- test/checks/aria/errormessage.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/checks/aria/errormessage.js b/lib/checks/aria/errormessage.js index 9798c35267..d93113fe82 100644 --- a/lib/checks/aria/errormessage.js +++ b/lib/checks/aria/errormessage.js @@ -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; } } diff --git a/test/checks/aria/errormessage.js b/test/checks/aria/errormessage.js index 3dc4f41a90..bc2eea55f9 100644 --- a/test/checks/aria/errormessage.js +++ b/test/checks/aria/errormessage.js @@ -56,6 +56,16 @@ describe('aria-errormessage', function() { ); }); + it('sets an array of IDs in data', function() { + var testHTML = '
'; + testHTML += '
'; + 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() {