From deaa1deff40c167708233d4e02ef76f2ebdc5f90 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 | 7 +++++-- test/checks/tables/same-caption-summary.js | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/lib/checks/tables/same-caption-summary.js b/lib/checks/tables/same-caption-summary.js index d8bdd9772f..7158ee728b 100644 --- a/lib/checks/tables/same-caption-summary.js +++ b/lib/checks/tables/same-caption-summary.js @@ -1,2 +1,5 @@ -// 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 +let summary = node.summary; +let caption = node.caption; +return !!(summary && caption) && summary.toLowerCase() === axe.commons.text.accessibleText(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( '
' +