Skip to content

Commit

Permalink
Add formatting to the helpUrl to avoid broken links
Browse files Browse the repository at this point in the history
Since we're using the alpha release, the help urls generated are not live yet.
This commit fixes that by pointing at the 2.3.x release, and adds a message
that'll be noticed if someone updated axe in the future.
  • Loading branch information
NickColley committed Aug 24, 2017
1 parent 2ecfaac commit 0f7d1fe
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
results.url + '\n\n' +
violations.map(function (violation) {
var help = 'Problem: ' + violation.help
var helpUrl = 'Try fixing it with this help: ' + violation.helpUrl
var helpUrl = 'Try fixing it with this help: ' + _formatHelpUrl(violation.helpUrl)
var htmlAndTarget = violation.nodes.map(_renderNode).join('\n\n')

return [
Expand All @@ -45,6 +45,14 @@
})
}

var _formatHelpUrl = function (helpUrl) {
if (axe.version.indexOf('alpha') === -1) {
console.warn('Deprecation warning: helpUrl formatting is no longer needed so can be deleted')
return helpUrl
}
return helpUrl.replace('3.0.0-alpha', '2.3')
}

var _renderNode = function (node) {
return (
' Check the HTML:\n' +
Expand Down

0 comments on commit 0f7d1fe

Please sign in to comment.