Comparing version 2.2.1 to 2.3.0
# History | ||
## 2.3.0 (2015-06-23) | ||
* Add a `wait` option for pages which take time to fully render | ||
* Relax development dependencies | ||
## 2.2.1 (2015-06-19) | ||
@@ -5,0 +10,0 @@ |
@@ -27,3 +27,3 @@ // This file is part of pa11y. | ||
runCodeSniffer(); | ||
setTimeout(runCodeSniffer, options.wait); | ||
@@ -30,0 +30,0 @@ function runCodeSniffer () { |
@@ -50,3 +50,4 @@ // This file is part of pa11y. | ||
standard: 'WCAG2AA', | ||
timeout: 30000 | ||
timeout: 30000, | ||
wait: 0 | ||
}; | ||
@@ -78,2 +79,5 @@ | ||
} | ||
if (typeof options.wait !== 'number' && !/^\d+$/.test(options.wait)) { | ||
return new Error('Wait time must be numeric'); | ||
} | ||
} | ||
@@ -85,3 +89,7 @@ | ||
clearTimeout(timer); | ||
options.log.debug('Test running completed (' + (Date.now() - startTime) + 'ms)'); | ||
options.log.debug( | ||
'Test running completed (' + | ||
(Date.now() - startTime - options.wait) + | ||
'ms)' | ||
); | ||
if (result instanceof Error) { | ||
@@ -140,2 +148,5 @@ return done(result); | ||
options.log.debug('Running Pa11y on the page (' + (Date.now() - startTime) + 'ms)'); | ||
if (options.wait > 0) { | ||
options.log.debug('Waiting for ' + options.wait + 'ms (pausing timer)'); | ||
} | ||
page.evaluate(function (options) { | ||
@@ -149,3 +160,4 @@ /* global injectPa11y: true, window: true */ | ||
ignore: options.ignore, | ||
standard: options.standard | ||
standard: options.standard, | ||
wait: options.wait | ||
}); | ||
@@ -152,0 +164,0 @@ } |
{ | ||
"name": "pa11y", | ||
"version": "2.2.1", | ||
"version": "2.3.0", | ||
@@ -36,8 +36,8 @@ "description": "pa11y is your automated accessibility testing pal", | ||
"devDependencies": { | ||
"jscs": "~1.13", | ||
"jshint": "~2.8", | ||
"mocha": "~2.2", | ||
"jscs": "^1", | ||
"jshint": "^2", | ||
"mocha": "^2", | ||
"mockery": "~1.4", | ||
"proclaim": "~3.2", | ||
"sinon": "~1.14" | ||
"proclaim": "^3", | ||
"sinon": "^1" | ||
}, | ||
@@ -44,0 +44,0 @@ |
@@ -83,2 +83,3 @@ | ||
-t, --timeout <ms> the timeout in milliseconds | ||
-w, --wait <ms> the time to wait before running tests in milliseconds | ||
-d, --debug output debug messages | ||
@@ -407,3 +408,15 @@ -H, --htmlcs <url/path> the URL or path to source HTML_CodeSniffer from | ||
### `wait` (number) | ||
The time in milliseconds to wait before running HTML CodeSniffer on the page. | ||
```js | ||
pa11y({ | ||
wait: 500 | ||
}); | ||
``` | ||
Defaults to `0`. | ||
Examples | ||
@@ -472,12 +485,6 @@ -------- | ||
```sh | ||
make lint test | ||
make ci | ||
``` | ||
We use [JavaScript Code Style][jscs] to ensure pa11y's source code is clean and consistent. You can check your work against our rules by running: | ||
```sh | ||
make jscs-check | ||
``` | ||
Migrating | ||
@@ -484,0 +491,0 @@ --------- |
@@ -29,3 +29,4 @@ // This file is part of pa11y. | ||
ignore: [], | ||
standard: 'FOO-STANDARD' | ||
standard: 'FOO-STANDARD', | ||
wait: 0 | ||
}; | ||
@@ -47,2 +48,13 @@ inject = require('../../../lib/inject'); | ||
it('should wait before processing the page if `options.wait` is set', function (done) { | ||
// Note: this test isn't particularly reliable, revisit some time | ||
var start = Date.now(); | ||
options.wait = 10; | ||
inject(window, options, function () { | ||
var end = Date.now() - start; | ||
assert.greaterThanOrEqual(end, 10); | ||
done(); | ||
}); | ||
}); | ||
it('should get the HTML CodeSniffer messages after processing the page', function (done) { | ||
@@ -49,0 +61,0 @@ inject(window, options, function () { |
@@ -125,2 +125,6 @@ // This file is part of pa11y. | ||
it('should have a `wait` property', function () { | ||
assert.strictEqual(defaults.wait, 0); | ||
}); | ||
}); | ||
@@ -162,2 +166,13 @@ | ||
it('should callback with an error if `options.wait` is invalid', function (done) { | ||
var options = { | ||
wait: 'foo' | ||
}; | ||
pa11y(options, function (error) { | ||
assert.isNotNull(error); | ||
assert.strictEqual(error.message, 'Wait time must be numeric'); | ||
done(); | ||
}); | ||
}); | ||
it('should lower-case all of the ignored codes and types', function (done) { | ||
@@ -239,3 +254,4 @@ var options = { | ||
], | ||
standard: 'Section508' | ||
standard: 'Section508', | ||
wait: 0 | ||
}; | ||
@@ -324,3 +340,4 @@ | ||
], | ||
standard: 'Section508' | ||
standard: 'Section508', | ||
wait: 0 | ||
}); | ||
@@ -327,0 +344,0 @@ done(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
257422
2302
526