From ca091ac17b09dda6f64816a56ae74d5bbd3d5f32 Mon Sep 17 00:00:00 2001 From: Marcy Sutton Date: Tue, 20 Mar 2018 12:43:04 -0700 Subject: [PATCH] fix: allow mixed casing of caption/summary Closes https://github.com/dequelabs/axe-core/issues/771 --- lib/checks/tables/same-caption-summary.js | 6 ++++-- test/checks/tables/same-caption-summary.js | 14 ++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/lib/checks/tables/same-caption-summary.js b/lib/checks/tables/same-caption-summary.js index d8bdd9772f..99038738d6 100644 --- a/lib/checks/tables/same-caption-summary.js +++ b/lib/checks/tables/same-caption-summary.js @@ -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(); diff --git a/test/checks/tables/same-caption-summary.js b/test/checks/tables/same-caption-summary.js index 3756d7381e..a17b6284ad 100644 --- a/test/checks/tables/same-caption-summary.js +++ b/test/checks/tables/same-caption-summary.js @@ -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('' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
my table
Head
Data
'); + + assert.isTrue(checks['same-caption-summary'].evaluate.apply(checkContext, params)); + }); + (shadowSupport.v1 ? it : xit)('should match slotted caption elements', function () { var params = shadowCheckSetup( '
' +