Skip to content

Commit 53cd4d2

Browse files
author
Jan Morawietz
committed
update documentation
1 parent 8c5c81b commit 53cd4d2

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,27 @@ if (process.env.NODE_ENV !== 'production') {
3636
|Key|Description|Default|Required|
3737
|---|---|---|---|
3838
|`clearConsoleOnUpdate`|Clears the console each time `vue-axe` runs|`true`|`false`|
39+
|`customResultHandler`|Handle the results from an `axe.run()`. This may be needed for automated tests.|`undefined`|`false`|
3940
|`config`|Provide your Axe-core configuration: https://github.com/dequelabs/axe-core/blob/master/doc/API.md#api-name-axeconfigure| |`false`|
4041

42+
#### Custom Result Handler
43+
44+
The `customResultHandler` config property expects a callback like the `axe.run()` callback ([see documentation](https://github.com/dequelabs/axe-core/blob/master/doc/API.md#parameters-axerun)). It will be triggered after each call to `axe.run()`.
45+
46+
```javascript
47+
import Vue from 'vue'
48+
49+
if (process.env.NODE_ENV !== 'production') {
50+
const VueAxe = require('vue-axe')
51+
Vue.use(VueAxe, {
52+
customResultHandler: (error, results) => {
53+
results.violations.forEach(violation => console.log(violation))
54+
}
55+
// ...
56+
})
57+
}
58+
```
59+
4160
## Install in Nuxt.js
4261
Create plugin file `plugins/axe.js`
4362
```javascript

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@
5959
"vue-template-compiler": "^2.6.11"
6060
},
6161
"dependencies": {
62-
"axe-core": "^3.4.1"
62+
"axe-core": "3.5.3"
6363
}
6464
}

src/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function checkAndReport (options, node) {
3131
return deferred.promise
3232
}
3333

34-
const standardResultHandler = function(error, results) {
34+
const standardResultHandler = function (errorInfo, results) {
3535
results.violations = results.violations.filter(result => {
3636
result.nodes = result.nodes.filter(node => {
3737
let key = node.target.toString() + result.id

0 commit comments

Comments
 (0)