Skip to content

Commit

Permalink
refactor(checks/unsupportedrole): change this.data from using array t…
Browse files Browse the repository at this point in the history
…o single string
  • Loading branch information
dan-tripp committed Feb 27, 2022
1 parent 840a581 commit 4bbd863
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/checks/aria/unsupportedrole-evaluate.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function unsupportedroleEvaluate(node, options, virtualNode) {
const role = getRole(virtualNode, { dpub: true, fallback: true });
const isUnsupported = isUnsupportedRole(role);
if (isUnsupported) {
this.data([role]);
this.data(role);
}
return isUnsupported;

Expand Down
2 changes: 1 addition & 1 deletion lib/checks/aria/unsupportedrole.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"impact": "critical",
"messages": {
"pass": "ARIA role is supported",
"fail": "The role used is not widely supported in screen readers and assistive technologies: ${data.values}"
"fail": "The role used is not widely supported in screen readers and assistive technologies: ${data}"
}
}
}
6 changes: 3 additions & 3 deletions test/checks/aria/unsupportedrole.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('unsupportedrole', function() {
'<div id="target" role="mccheddarton">Contents</div>'
);
assert.isTrue(check.evaluate.apply(checkContext, params));
assert.deepEqual(checkContext._data, ["mccheddarton"]);
assert.deepEqual(checkContext._data, "mccheddarton");
});

it('should return false if applied to a supported role', function() {
Expand Down Expand Up @@ -60,7 +60,7 @@ describe('unsupportedrole', function() {
'<div id="target" role="doc-abstract">Contents</div>'
);
assert.isTrue(check.evaluate.apply(checkContext, params));
assert.deepEqual(checkContext._data, ["doc-abstract"]);
assert.deepEqual(checkContext._data, "doc-abstract");
});

it('should return true if applied to an unsupported fallback role', function() {
Expand All @@ -79,7 +79,7 @@ describe('unsupportedrole', function() {
'<div id="target" role="unsupported alert">Contents</div>'
);
assert.isTrue(check.evaluate.apply(checkContext, params));
assert.deepEqual(checkContext._data, ["alert"]);
assert.deepEqual(checkContext._data, "alert");
});

});

0 comments on commit 4bbd863

Please sign in to comment.