Skip to content

Commit

Permalink
test(a11y): add basic accessibility testing using grunt-accessibility
Browse files Browse the repository at this point in the history
  • Loading branch information
OwenEdwards authored and gkatsev committed Sep 30, 2016
1 parent ae3e277 commit 7d85f27
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
25 changes: 24 additions & 1 deletion build/grunt.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ module.exports = function(grunt) {
swf: { cwd: 'node_modules/videojs-swf/dist/', src: 'video-js.swf', dest: 'build/temp/', expand: true, filter: 'isFile' },
ie8: { cwd: 'node_modules/videojs-ie8/dist/', src: ['**/**'], dest: 'build/temp/ie8/', expand: true, filter: 'isFile' },
dist: { cwd: 'build/temp/', src: ['**/**', '!test*'], dest: 'dist/', expand: true, filter: 'isFile' },
a11y: { src: 'sandbox/descriptions.html.example', dest: 'sandbox/descriptions.test-a11y.html' }, // Can only test a file with a .html or .htm extension
examples: { cwd: 'docs/examples/', src: ['**/**'], dest: 'dist/examples/', expand: true, filter: 'isFile' }
},
cssmin: {
Expand Down Expand Up @@ -454,6 +455,24 @@ module.exports = function(grunt) {
preferLocal: true
}
}
},
accessibility: {
options: {
accessibilityLevel: 'WCAG2AA',
reportLevels: {
notice: false,
warning: true,
error: true
},
ignore: [
// Ignore the warning about needing <optgroup> elements
'WCAG2AA.Principle1.Guideline1_3.1_3_1.H85.2'
]

},
test: {
src: ['sandbox/descriptions.test-a11y.html']
}
}
});

Expand All @@ -462,6 +481,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('videojs-doc-generator');
grunt.loadNpmTasks('chg');
grunt.loadNpmTasks('gkatsev-grunt-sass');
grunt.loadNpmTasks('grunt-accessibility');

const buildDependents = [
'shell:lint',
Expand Down Expand Up @@ -511,13 +531,16 @@ module.exports = function(grunt) {
'shell:noderequire',
'shell:browserify',
'shell:webpack',
'karma:defaults'].concat(process.env.TRAVIS && 'coveralls').filter(Boolean));
'karma:defaults',
'test-a11y'].concat(process.env.TRAVIS && 'coveralls').filter(Boolean));

// Run while developing
grunt.registerTask('dev', ['build', 'connect:dev', 'concurrent:watchSandbox']);

grunt.registerTask('watchAll', ['build', 'connect:dev', 'concurrent:watchAll']);

grunt.registerTask('test-a11y', ['copy:a11y', 'accessibility']);

// Pick your testing, or run both in different terminals
grunt.registerTask('test-ui', ['browserify:tests']);
grunt.registerTask('test-cli', ['karma:watch']);
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"gkatsev-grunt-sass": "^1.1.1",
"grunt": "^0.4.4",
"grunt-babel": "^6.0.0",
"grunt-accessibility": "^4.1.0",
"grunt-banner": "^0.4.0",
"grunt-browserify": "3.5.1",
"grunt-cli": "~0.1.13",
Expand Down

0 comments on commit 7d85f27

Please sign in to comment.