Skip to content

Commit

Permalink
Merge pull request #310 from dequelabs/merge-2.2.0
Browse files Browse the repository at this point in the history
Merge 2.2.0
  • Loading branch information
marcysutton authored Apr 26, 2017
2 parents 020fd15 + c993713 commit ed83eec
Show file tree
Hide file tree
Showing 162 changed files with 2,510 additions and 553 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.npmignore merge=ours
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ node_modules
test/*/index.html
test/integration/*/index.html
axe.js
axe.min.js
axe.es2016.js
axe.*.js
*.tgz
npm-shrinkwrap.json
typings/axe-core/axe-core-tests.js
doc/rule-descriptions.*.md
5 changes: 0 additions & 5 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
tmp
dist
node_modules
build
lib
test
*.tgz
bower.json
typings/axe-core
26 changes: 26 additions & 0 deletions .retireignore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"path": "node_modules/tough-cookie",
"justification" : "We do not make any HTTP requests"
},
{
"path": "node_modules/retire",
"justification" : "Used only for testing"
},
{
"path": "node_modules/grunt-retire",
"justification" : "Used only for testing"
},
{
"path": "node_modules/grunt-mocha",
"justification" : "Used only for testing"
},
{
"path": "node_modules/grunt-lib-phantomjs",
"justification" : "Used only for testing"
},
{
"path": "node_modules/request",
"justification" : "Used only for testing"
}
]
24 changes: 24 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,27 @@ v2.1.7:
- Color contrast rule performance improvements using polyfilled elementsFromPoint
- Add better support for implicit roles
- DQElement supports xPath
v2.1.8:
date: 2017-02-21
changes:
- Move from Snyk to Retire.js
- Make CI run test-fast task instead of parallel
- Add documentation on writing integration tests and rules
- Allow a larger list of languages for HTML-valid-lang rule
- Add support for [role=img] in image-alt rule
- Fix bug with innerHeight in get-background-color
- Improve dom.is-offscreen function
- Integrate optional performance timer
- Empty include defaults to document
v2.2.0:
date: 2017-04-24
changes:
- Add configuration options for iframes: false, selectors: false, and elementRef: true
- Improve color-contrast rule for disabled elements
- Add webdriver task for testing mobile viewports
- Improve audio/video captioning rules
- Improve th-has-data-cells rule
- Expose incomplete reasons for color contrast rule as part of Needs Review
- Implement rule groupings as tags
- Allow building of axe in multiple languages
- Empty-heading rule has impact: moderate
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ grunt build

### aXe Development

The TypeScript definition file for axe-core is distributed with this module [axe.d.ts](./axe.d.ts). It currently supports TypeScript 2.0+.
The TypeScript definition file for axe-core is distributed with this module and can be found in [axe.d.ts](./axe.d.ts). It currently supports TypeScript 2.0+.

To maintain aXe support for TypeScript you must first install it (globally recommended):
```
Expand All @@ -135,4 +135,4 @@ describe('Module', () => {
});
});
});
```
```
134 changes: 95 additions & 39 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,30 @@ module.exports = function (grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-retire');
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-snyk');
grunt.loadTasks('build/tasks');
grunt.loadNpmTasks('grunt-parallel');

var langs;
if (grunt.option('lang')) {
langs = (grunt.option('lang') || '')
.split(/[,;]/g).map(function (lang) {
lang = lang.trim();
return (lang !== 'en' ? '.' + lang : '');
});

} else if (grunt.option('all-lang')) {
var localeFiles = require('fs').readdirSync('./locales');
langs = localeFiles.map(function (file) {
return '.' + file.replace('.json', '');
});
langs.unshift(''); // Add default

} else {
langs = [''];
}

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
parallel: {
Expand All @@ -29,12 +48,21 @@ module.exports = function (grunt) {
'test-webdriver:chrome',
// Edge Webdriver isn't all too stable, manual testing required
// 'test-webdriver:edge',
'test-webdriver:safari',
'test-webdriver:ie'
// 'test-webdriver:safari',
'test-webdriver:ie',
'test-webdriver:chrome-mobile'
]
}
},
clean: ['dist', 'tmp'],
retire: {
options: {
/** list of files to ignore **/
ignorefile: '.retireignore.json' //or '.retireignore.json'
},
js: ['lib/*.js'], /** Which js-files to scan. **/
node: ['./'] /** Which node directories to scan (containing package.json). **/
},
clean: ['dist', 'tmp', 'axe.js', 'axe.*.js'],
babel: {
options: {
compact: 'false'
Expand Down Expand Up @@ -66,20 +94,27 @@ module.exports = function (grunt) {
},
concat: {
engine: {
src: [
'lib/intro.stub',
coreFiles: [
'tmp/core/index.js',
'tmp/core/*/index.js',
'tmp/core/**/index.js',
'tmp/core/**/*.js',
// include rules / checks / commons
'<%= configure.rules.dest.auto %>',
'lib/outro.stub'
'tmp/core/**/*.js'
],
dest: 'axe.js',
options: {
process: true
}
},
files: langs.map(function (lang, i) {
return {
src: [
'lib/intro.stub',
'<%= concat.engine.coreFiles %>',
// include rules / checks / commons
'<%= configure.rules.files[' + i + '].dest.auto %>',
'lib/outro.stub'
],
dest: 'axe' + lang + '.js',
};
})
},
commons: {
src: [
Expand All @@ -94,14 +129,26 @@ module.exports = function (grunt) {
},
configure: {
rules: {
src: ['<%= concat.commons.dest %>'],
tmp: 'tmp/rules.js',
options: {
tags: grunt.option('tags')
},
dest: {
auto: 'tmp/rules.js',
descriptions: 'doc/rule-descriptions.md'
}
files: langs.map(function (lang) {
return {
src: ['<%= concat.commons.dest %>'],
dest: {
auto: 'tmp/rules' + lang + '.js',
descriptions: 'doc/rule-descriptions' + lang + '.md'
}
};
})
}
},
'add-locale': {
newLang: {
options: { lang: grunt.option('lang') },
src: ['<%= concat.commons.dest %>'],
dest: './locales/' + (grunt.option('lang') || 'new-locale') + '.json'
}
},
langs : {
Expand Down Expand Up @@ -131,10 +178,12 @@ module.exports = function (grunt) {
},
uglify: {
beautify: {
files: [{
src: ['./axe.js'],
dest: './axe.js'
}],
files: langs.map(function (lang, i) {
return {
src: ['<%= concat.engine.files[' + i + '].dest %>'],
dest: '<%= concat.engine.files[' + i + '].dest %>'
};
}),
options: {
mangle: false,
compress: false,
Expand All @@ -148,10 +197,12 @@ module.exports = function (grunt) {
}
},
minify: {
files: [{
src: ['<%= concat.engine.dest %>'],
dest: './axe.min.js'
}],
files: langs.map(function (lang, i) {
return {
src: ['<%= concat.engine.files[' + i + '].dest %>'],
dest: './axe' + lang + '.min.js'
};
}),
options: {
preserveComments: function(node, comment) {
// preserve comments that start with a bang
Expand All @@ -175,7 +226,7 @@ module.exports = function (grunt) {
},
fixture: {
engine: {
src: '<%= concat.engine.src %>',
src: ['<%= concat.engine.coreFiles %>'],
dest: 'test/core/index.html',
options: {
fixture: 'test/runner.tmpl',
Expand All @@ -187,9 +238,9 @@ module.exports = function (grunt) {
},
checks: {
src: [
'<%= concat.engine.dest %>',
'<%= concat.engine.files[0].dest %>',
'build/test/engine.js',
'<%= configure.rules.dest.auto %>'
'<%= configure.rules.tmp %>'
],
dest: 'test/checks/index.html',
options: {
Expand All @@ -202,9 +253,9 @@ module.exports = function (grunt) {
},
commons: {
src: [
'<%= concat.engine.dest %>',
'<%= concat.engine.files[0].dest %>',
'build/test/engine.js',
'<%= configure.rules.dest.auto %>'
'<%= configure.rules.tmp %>'
],
dest: 'test/commons/index.html',
options: {
Expand All @@ -217,9 +268,9 @@ module.exports = function (grunt) {
},
ruleMatches: {
src: [
'<%= concat.engine.dest %>',
'<%= concat.engine.files[0].dest %>',
'build/test/engine.js',
'<%= configure.rules.dest.auto %>'
'<%= configure.rules.tmp %>'
],
dest: 'test/rule-matches/index.html',
options: {
Expand All @@ -231,7 +282,7 @@ module.exports = function (grunt) {
}
},
integration: {
src: ['<%= concat.engine.dest %>'],
src: ['<%= concat.engine.files[0].dest %>'],
dest: 'test/integration/rules/index.html',
options: {
fixture: 'test/runner.tmpl',
Expand All @@ -252,7 +303,7 @@ module.exports = function (grunt) {
options.urls = options.urls.concat(tests.integration.options.urls);
var driverTests = {};

['firefox', 'chrome', 'ie', 'safari', 'edge']
['firefox', 'chrome', 'ie', 'safari', 'edge', 'chrome-mobile']
.forEach(function (browser) {
driverTests[browser] = {
options: Object.assign({ browser: browser }, options)
Expand Down Expand Up @@ -283,17 +334,22 @@ module.exports = function (grunt) {

grunt.registerTask('default', ['build']);

grunt.registerTask('build', ['clean', 'jshint', 'validate', 'snyk', 'concat:commons', 'configure',
grunt.registerTask('build', ['clean', 'jshint', 'validate', 'concat:commons', 'configure',
'babel', 'concat:engine', 'uglify']);

grunt.registerTask('test', ['build', 'testconfig', 'fixture', 'connect',
grunt.registerTask('test', ['build', 'retire', 'testconfig', 'fixture', 'connect',
'mocha', 'parallel', 'jshint']);

grunt.registerTask('ci-build', ['clean', 'jshint', 'validate', 'concat:commons', 'configure',
'babel', 'concat:engine', 'uglify']);
grunt.registerTask('ci-build', ['build', 'retire', 'testconfig', 'fixture', 'connect',
'parallel', 'jshint']);

grunt.registerTask('test-fast', ['ci-build', 'testconfig', 'fixture', 'connect',
grunt.registerTask('test-fast', ['build', 'testconfig', 'fixture', 'connect',
'mocha', 'jshint']);

grunt.registerTask('translate', ['clean', 'jshint', 'validate', 'concat:commons', 'add-locale']);

grunt.registerTask('dev', ['build', 'testconfig', 'fixture', 'connect', 'watch']);

grunt.registerTask('dev:no-lint', ['clean', 'validate', 'concat:commons', 'configure',
'babel', 'concat:engine', 'uglify', 'testconfig', 'fixture', 'connect', 'watch']);
};
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ The [aXe API](doc/API.md) package consists of:
* `axe.js` - the JavaScript file that should be included in your web site under test (API)
* `axe.min.js` - a minified version of the above file

## Localization

Axe can be build using your local language. To do so, a localization file must be added to the `./locales` directory. This file must have be named in the following manner: `<langcode>.json`. To build aXe using this locale, instead of the default, run aXe with the `--lang` flag, like so:

`grunt build --lang=nl`

This will create a new build for aXe, called `axe.<lang>.js` and `axe.<lang>.min.js`. If you want to build localized versions, simply pass in `--all-lang` instead.

To create a new translation for aXe, start by running `grunt translate --lang=<langcode>`. This will create a json file fin the `./locales` directory, with the default English text in it for you to translate. We welcome any localization for axe-core. For details on how to contribute, see the Contributing section below.

## Contributing

Expand Down
6 changes: 3 additions & 3 deletions axe.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Type definitions for axe-core 2.1.7
// Type definitions for axe-core 2.2.0
// Project: https://github.com/dequelabs/axe-core
// Definitions by: Marcy Sutton <https://github.com/marcysutton>

Expand Down Expand Up @@ -122,7 +122,7 @@ declare module axe {
* @param {Function} callback Optional The function to invoke when analysis is complete.
* @returns {any} results If the callback was not defined, aXe will return a Promise instead.
*/
function run(context?: ElementContext, options?: {runOnly?: RunOnly, rules?: Object}, callback?: (error: Error, results:AxeResults) => void): any
function run(context?: ElementContext, options?: {runOnly?: RunOnly, rules?: Object, iframes?: Boolean, elementRef?: Boolean, selectors?: Boolean}, callback?: (error: Error, results:AxeResults) => void): any

/**
* Starts analysis on the current document and its subframes
Expand All @@ -132,7 +132,7 @@ declare module axe {
* @param {Function} callback The function to invoke when analysis is complete.
* @returns {Object} results The aXe results object
*/
function a11yCheck(context: ElementContext, options: {runOnly?: RunOnly, rules?: Object}, callback: (results:AxeResults) => void): AxeResults
function a11yCheck(context: ElementContext, options: {runOnly?: RunOnly, rules?: Object, iframes?: Boolean, elementRef?: Boolean, selectors?: Boolean}, callback: (results:AxeResults) => void): AxeResults

/**
* Method for configuring the data format used by aXe. Helpful for adding new
Expand Down
1 change: 0 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "axe-core",
"description": "Accessibility engine for automated Web UI testing",
"version": "2.1.7",
"contributors": [
{
Expand Down
Loading

0 comments on commit ed83eec

Please sign in to comment.