Comparing version 4.2.0 to 4.3.0
# Changelog | ||
## 4.3.0 (2016-12-15) | ||
* Add a `verifyPage` option, and a `--verify-page` flag | ||
* Switch from JSHint/JSCS to ESLint | ||
* Add a contributing guide | ||
* Update dependencies | ||
* istanbul: ~0.3 to ~0.4 | ||
## 4.2.0 (2016-11-25) | ||
@@ -5,0 +13,0 @@ |
'use strict'; | ||
/* eslint-disable max-statements */ | ||
function injectPa11y(window, options, done) { | ||
// jshint maxstatements: false | ||
if (options.verifyPage) { | ||
var windowHtml = window.document.documentElement.outerHTML; | ||
if (!windowHtml.match(new RegExp(options.verifyPage))) { | ||
return reportError('Page not verified - HTML did not contain: "' + options.verifyPage + '"'); | ||
} | ||
} | ||
var messageTypeMap = { | ||
@@ -11,2 +18,3 @@ 1: 'error', | ||
}; | ||
setTimeout(runCodeSniffer, options.wait); | ||
@@ -146,3 +154,3 @@ | ||
function hiddenAreasContainsElement(element, hiddenSelectors) { | ||
/*jshint maxcomplexity:5, maxdepth:3 */ | ||
/* eslint complexity:["error", 5], max-depth:["error", 3] */ | ||
var hiddenElements = window.document.querySelectorAll(hiddenSelectors); | ||
@@ -183,2 +191,3 @@ | ||
} | ||
/* eslint-enable max-statements */ | ||
@@ -185,0 +194,0 @@ /* istanbul ignore next */ |
@@ -40,3 +40,4 @@ 'use strict'; | ||
allowedStandards: ['Section508', 'WCAG2A', 'WCAG2AA', 'WCAG2AAA'], | ||
wait: 0 | ||
wait: 0, | ||
verifyPage: null | ||
}; | ||
@@ -145,3 +146,4 @@ | ||
standard: options.standard, | ||
wait: options.wait | ||
wait: options.wait, | ||
verifyPage: options.verifyPage | ||
}, next); | ||
@@ -148,0 +150,0 @@ } |
{ | ||
"name": "pa11y", | ||
"version": "4.2.0", | ||
"version": "4.3.0", | ||
"description": "Pa11y is your automated accessibility testing pal", | ||
@@ -44,5 +44,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"istanbul": "~0.3", | ||
"jscs": "^2", | ||
"jshint": "^2", | ||
"eslint": "^3.11.1", | ||
"istanbul": "~0.4", | ||
"mocha": "^3", | ||
@@ -49,0 +48,0 @@ "mockery": "~1.4", |
@@ -105,2 +105,3 @@ | ||
-w, --wait <ms> the time to wait before running tests in milliseconds | ||
-v, --verify-page <string> HTML string to verify is present in the page source HTML | ||
-d, --debug output debug messages | ||
@@ -553,3 +554,15 @@ -H, --htmlcs <url> the URL or path to source HTML_CodeSniffer from | ||
### `verifyPage` (string) | ||
HTML string to verify is present in the page source HTML. Could be used to ascertain that intended page is being tested (as opposed to error page) by using `<title>` tags and content (as below), or that a specific element is present. | ||
```js | ||
pa11y({ | ||
verifyPage: '<title>Nature Research: science journals, jobs, information and services.</title>' | ||
}); | ||
``` | ||
Defaults to `null`. | ||
Examples | ||
@@ -740,5 +753,5 @@ -------- | ||
To contribute to Pa11y, clone this repo locally and commit your code on a separate branch. | ||
There are many ways to contribute to Pa11y, we cover these in the [contributing guide](CONTRIBUTING.md) for this repo. | ||
Please write unit tests for your code, and check that everything works by running the following before opening a pull-request: | ||
If you're ready to contribute some code, clone this repo locally and commit on a separate branch. Please write unit tests for your changes, and check that everything works by running the following before opening a pull-request: | ||
@@ -770,3 +783,3 @@ ```sh | ||
Pa11y is licensed under the [Lesser General Public License (LGPL-3.0)][info-license]. | ||
Pa11y is licensed under the [Lesser General Public License (LGPL-3.0)][info-license].<br> | ||
Copyright © 2016, Springer Nature | ||
@@ -773,0 +786,0 @@ |
@@ -23,3 +23,3 @@ 'use strict'; | ||
function buildCsv(results) { | ||
return ['"type","code","message","context","selector"'] | ||
return [ '"type","code","message","context","selector"' ] | ||
.concat(results.map(buildCsvRow)) | ||
@@ -26,0 +26,0 @@ .join('\n'); |
@@ -1,3 +0,1 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable maximumLineLength | ||
'use strict'; | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable maximumLineLength | ||
'use strict'; | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable maximumLineLength | ||
'use strict'; | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable maximumLineLength | ||
'use strict'; | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable maximumLineLength | ||
'use strict'; | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,2 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable maximumLineLength | ||
/* eslint-disable max-len */ | ||
'use strict'; | ||
@@ -23,1 +22,2 @@ | ||
}); | ||
/* eslint-enable max-len */ |
@@ -1,3 +0,2 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable maximumLineLength | ||
/* eslint-disable max-len */ | ||
'use strict'; | ||
@@ -23,1 +22,2 @@ | ||
}); | ||
/* eslint-enable max-len */ |
@@ -1,3 +0,2 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable maximumLineLength | ||
/* eslint-disable max-len */ | ||
'use strict'; | ||
@@ -23,1 +22,2 @@ | ||
}); | ||
/* eslint-enable max-len */ |
@@ -1,3 +0,1 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable maximumLineLength | ||
'use strict'; | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable maximumLineLength | ||
'use strict'; | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable maximumLineLength | ||
'use strict'; | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,1 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable maximumLineLength | ||
'use strict'; | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,2 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable maximumLineLength | ||
/* eslint-disable max-len, max-statements */ | ||
'use strict'; | ||
@@ -51,2 +50,2 @@ | ||
} | ||
/* eslint-enable max-len, max-statements */ |
@@ -1,3 +0,1 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable maximumLineLength | ||
'use strict'; | ||
@@ -4,0 +2,0 @@ |
@@ -1,3 +0,2 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable disallowMultipleVarDecl, maximumLineLength | ||
/* eslint-disable one-var, max-len, max-statements */ | ||
'use strict'; | ||
@@ -545,2 +544,24 @@ | ||
describe('verifyPage flag', function() { | ||
it('should not error when verifyPage value exists in HTML', function(done) { | ||
options.verifyPage = '<title>Foo</title>'; | ||
inject(window, options, function(result) { | ||
assert.isUndefined(result.error); | ||
done(); | ||
}); | ||
}); | ||
it('should error when verifyPage value does not exist in HTML', function(done) { | ||
options.verifyPage = '<title>Bar</title>'; | ||
inject(window, options, function(result) { | ||
assert.isDefined(result.error); | ||
assert.strictEqual(result.error, 'Page not verified - HTML did not contain: "<title>Bar</title>"'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
/* eslint-enable one-var, max-len, max-statements */ |
@@ -1,3 +0,2 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable disallowMultipleVarDecl, maximumLineLength | ||
/* eslint-disable one-var, max-len, max-statements */ | ||
'use strict'; | ||
@@ -344,2 +343,3 @@ | ||
wait: 0, | ||
verifyPage: null, | ||
rootElement: null | ||
@@ -453,1 +453,2 @@ }); | ||
}); | ||
/* eslint-enable one-var, max-len, max-statements */ |
@@ -8,2 +8,5 @@ 'use strict'; | ||
document: { | ||
documentElement: { | ||
outerHTML: '<title>Foo</title>' | ||
}, | ||
querySelector: sinon.stub().returns(null), | ||
@@ -10,0 +13,0 @@ querySelectorAll: sinon.stub().returns([]) |
@@ -1,3 +0,1 @@ | ||
// jshint maxstatements: false | ||
// jscs:disable maximumLineLength | ||
'use strict'; | ||
@@ -4,0 +2,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
254093
6
2652
814