Skip to content

Commit

Permalink
feat(report): add a 'Best Practice' rule category
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeltour committed Dec 24, 2017
1 parent 85ffb96 commit b5ed308
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/ace-report/src/generate-html-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ module.exports = function generateHtmlReport(reportData) {
'wcag2a': 'WCAG 2.0 A',
'wcag2aa': 'WCAG 2.0 AA',
'EPUB': 'EPUB',
'best-practice': 'Best Practice',
'other': 'Other'
};
violationFilters[rule].forEach(function(value) {
Expand Down Expand Up @@ -60,12 +61,13 @@ module.exports = function generateHtmlReport(reportData) {

// summarize the violation ruleset and impact data
function collectViolationStats(flatListOfViolations) {
var rulesetTags = ['wcag2a', 'wcag2aa', 'EPUB'];
var rulesetTags = ['wcag2a', 'wcag2aa', 'EPUB', 'best-practice'];

var summaryData = {
'wcag2a': {'critical': 0, 'serious': 0, 'moderate': 0, 'minor': 0, 'total': 0},
'wcag2aa': {'critical': 0, 'serious': 0, 'moderate': 0, 'minor': 0, 'total': 0},
'EPUB': {'critical': 0, 'serious': 0, 'moderate': 0, 'minor': 0, 'total': 0},
'best-practice': {'critical': 0, 'serious': 0, 'moderate': 0, 'minor': 0, 'total': 0},
'other': {'critical': 0, 'serious': 0, 'moderate': 0, 'minor': 0, 'total': 0},
'total': {'critical': 0, 'serious': 0, 'moderate': 0, 'minor': 0, 'total': 0}
};
Expand All @@ -89,6 +91,7 @@ function collectViolationStats(flatListOfViolations) {
summaryData['total'][key] += summaryData['wcag2a'][key]
+ summaryData['wcag2aa'][key]
+ summaryData['EPUB'][key]
+ summaryData['best-practice'][key]
+ summaryData['other'][key];
});

Expand Down Expand Up @@ -118,7 +121,7 @@ function createViolationFilters(violations) {
// we're using 'assertion' and 'violation' somewhat interchangeably
function createFlatListOfViolations(violations) {
var flatData = [];
var rulesetTags = ['wcag2a', 'wcag2aa', 'EPUB']; // applicable ruleset tags
var rulesetTags = ['wcag2a', 'wcag2aa', 'EPUB', 'best-practice']; // applicable ruleset tags

violations.forEach(function(assertion) {
var filename = assertion["earl:testSubject"]["url"];
Expand Down
5 changes: 5 additions & 0 deletions packages/ace-report/src/resources/report-template.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@
<th scope="row">EPUB</th>
{{#violation_stats "EPUB"}}{{/violation_stats}}
</tr>
<tr>
<th scope="row">Best Practice</th>
{{#violation_stats "best-practice"}}{{/violation_stats}}
</tr>
<tr>
<th scope="row">Other</th>
{{#violation_stats "other"}}{{/violation_stats}}
Expand Down Expand Up @@ -435,6 +439,7 @@
'wcag2a': 'WCAG 2.0 A',
'wcag2aa': 'WCAG 2.0 AA',
'EPUB': 'EPUB',
'best-practice': 'Best Practice',
'other': 'Other'
};
Expand Down

0 comments on commit b5ed308

Please sign in to comment.