From 0b2244800c5bfc0b859d4975f820cb24dd9f1aba Mon Sep 17 00:00:00 2001 From: Takayuki Shimada Date: Tue, 14 Apr 2020 07:12:27 +0900 Subject: [PATCH 1/2] Skip selector calculation of non-violation results --- src/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils.js b/src/utils.js index 4539dd5..4ace142 100644 --- a/src/utils.js +++ b/src/utils.js @@ -13,7 +13,7 @@ export function checkAndReport (options, node) { nodes.push(node) let deferred = createDeferred() - axeCore.run(document, { reporter: 'v2' }, (error, results) => { + axeCore.run(document, { reporter: 'v2', resultTypes: ['violations'] }, (error, results) => { if (error) deferred.reject(error) if (!results) return if (JSON.stringify(results.violations) === lastNotification) return From bb8025eefad0954bb4e58e367e4d2fb84d1eeabb Mon Sep 17 00:00:00 2001 From: Takayuki Shimada Date: Wed, 22 Apr 2020 05:40:56 +0900 Subject: [PATCH 2/2] Expose axe-core runtime options --- README.md | 3 ++- src/index.js | 4 ++++ src/utils.js | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 76f33fb..9e02967 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,8 @@ if (process.env.NODE_ENV !== 'production') { |Key|Description|Default|Required| |---|---|---|---| |`clearConsoleOnUpdate`|Clears the console each time `vue-axe` runs|`true`|`false`| -|`config`|Provide your Axe-core configuration: https://github.com/dequelabs/axe-core/blob/master/doc/API.md#api-name-axeconfigure| |`false`| +|`config`|Provide your Axe-core configuration: [API Name: axe.configure](https://github.com/dequelabs/axe-core/blob/master/doc/API.md#api-name-axeconfigure)| |`false`| +|`runOptions`|Provide your Axe-core runtime options: [API Name: axe.run](https://github.com/dequelabs/axe-core/blob/master/doc/API.md#options-parameter)|`{ reporter: 'v2', resultTypes: ['violations'] }`|`false`| ## Install in Nuxt.js Create plugin file `plugins/axe.js` diff --git a/src/index.js b/src/index.js index 51c88b3..39c9b84 100644 --- a/src/index.js +++ b/src/index.js @@ -9,6 +9,10 @@ export default function install (Vue, options) { options = { clearConsoleOnUpdate: true, + runOptions: { + reporter: 'v2', + resultTypes: ['violations'] + }, ...options } diff --git a/src/utils.js b/src/utils.js index 4ace142..84f70f3 100644 --- a/src/utils.js +++ b/src/utils.js @@ -13,7 +13,7 @@ export function checkAndReport (options, node) { nodes.push(node) let deferred = createDeferred() - axeCore.run(document, { reporter: 'v2', resultTypes: ['violations'] }, (error, results) => { + axeCore.run(document, options.runOptions, (error, results) => { if (error) deferred.reject(error) if (!results) return if (JSON.stringify(results.violations) === lastNotification) return