Skip to content

Commit

Permalink
fix: allow mixed casing of caption/summary
Browse files Browse the repository at this point in the history
Closes #771
  • Loading branch information
Marcy Sutton committed Mar 20, 2018
1 parent 404cf48 commit ca091ac
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/checks/tables/same-caption-summary.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
// passing node.caption to accessibleText instead of using the logic in accessibleTextVirtual on virtualNode
return !!(node.summary && node.caption) && node.summary === axe.commons.text.accessibleText(node.caption);
// passing node.caption to accessibleText instead of using
// the logic in accessibleTextVirtual on virtualNode
return !!(node.summary && node.caption) &&
node.summary.toLowerCase() === axe.commons.text.accessibleText(node.caption).toLowerCase();
14 changes: 14 additions & 0 deletions test/checks/tables/same-caption-summary.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ describe('same-caption-summary', function () {
assert.isTrue(checks['same-caption-summary'].evaluate.apply(checkContext, params));
});

it('should return true if summary and caption are the same with mixed casing', function () {
var params = checkSetup('<table summary="My Table" id="target">' +
'<caption> my table </caption>' +
'<thead>' +
'<tr><th scope="col">Head</th></tr>' +
'</thead>' +
'<tbody>' +
'<tr><td>Data</td></tr>' +
'</tbody>' +
'</table>');

assert.isTrue(checks['same-caption-summary'].evaluate.apply(checkContext, params));
});

(shadowSupport.v1 ? it : xit)('should match slotted caption elements', function () {
var params = shadowCheckSetup(
'<div>' +
Expand Down

0 comments on commit ca091ac

Please sign in to comment.