From 265f160e55d98b37aa8d8f9b16a1a5ccb32bdb0d Mon Sep 17 00:00:00 2001 From: Benjamin Jones Date: Thu, 11 Jul 2013 16:07:03 -0700 Subject: added WCAG 1.0 Guideline 5 and test HTML for it --- guidelines/WCAG-1.0/guideline-5.js | 34 ++++++++++++++++++++++++++++ guidelines/WCAG-1.0/guideline-test.json | 6 +++++ guidelines/WCAG-1.0/test5.html | 40 +++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 guidelines/WCAG-1.0/guideline-5.js create mode 100644 guidelines/WCAG-1.0/guideline-test.json create mode 100644 guidelines/WCAG-1.0/test5.html (limited to 'guidelines') diff --git a/guidelines/WCAG-1.0/guideline-5.js b/guidelines/WCAG-1.0/guideline-5.js new file mode 100644 index 0000000..48feb49 --- /dev/null +++ b/guidelines/WCAG-1.0/guideline-5.js @@ -0,0 +1,34 @@ +exports.name = "WCAG 1.0 Guideline 5: Tables"; +exports.description = "Web Accessibility Guideline: Create tables that transform gracefully"; +exports.rule = function(report) { + + /* Checkpoint 5.1 *********************************************************** + * + * For data tables, identify row and column headers. + */ + + $('table').each(function () { + if ($(this).find('th').length == 0) { + report.error('Table does not have column headers ', this); + } + }); + + + /* Checkpoint 5.5 *********************************************************** + * + * Provide summaries for tables. + */ + + $('table').each(function () { + var $cap = $(this).find('caption'); + var title = $.trim($(this).attr('title')); + var sum = $.trim($(this).attr('summary')); + if ($cap.length == 0 && (title === undefined || title == '')) { + report.error('Table has no caption or title attribute', this); + } + if (sum === undefined || sum == '') { + report.error('Table has no summary attribute', this); + } + }); + +}; diff --git a/guidelines/WCAG-1.0/guideline-test.json b/guidelines/WCAG-1.0/guideline-test.json new file mode 100644 index 0000000..29bfaa3 --- /dev/null +++ b/guidelines/WCAG-1.0/guideline-test.json @@ -0,0 +1,6 @@ +{ "name": "guideline-test" +, "description": "Test WCAG guidelines" +, "license": "BSD3" +, "rules": + [ "guideline-5.js" ] +} diff --git a/guidelines/WCAG-1.0/test5.html b/guidelines/WCAG-1.0/test5.html new file mode 100644 index 0000000..8700531 --- /dev/null +++ b/guidelines/WCAG-1.0/test5.html @@ -0,0 +1,40 @@ + + + Test 5 + + + + + Hello World! + + + + + + +
A first row that's not a headerAnother col
A first row that's not a headerAnother col
+ + Hello Wisconsin! + + + + + + +
WI A first row that's not a headerAnother col
WI A first row that's not a headerAnother col
+ + Hello Oregon! + + + + + + + + +
A mighty good table
State head 1 head 2
OR A first row that's not a header Another col
OR A first row that's not a header Another col
+ + + -- cgit v1.2.3