Skip to content

Commit 0d4cd42

Browse files
authored
Merge pull request #2 from MechJosh0/master
Debounce and do not clear console features + more minor changes
2 parents 0e2163b + 8973126 commit 0d4cd42

File tree

13 files changed

+1976
-1359
lines changed

13 files changed

+1976
-1359
lines changed

.gitignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
.idea
12
node_modules
2-
dist
33
.editorconfig
44
.DS_Store
55
demo/vue-axe.js
66
demo/node_modules
77
demo/dist
88
demo/CNAME
9-
demo/package-lock.json
9+
demo/package-lock.json
10+
cypress

CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
<a name="1.0.6"></a>
6+
## [1.0.6](https://github.com/vue-a11y/vue-axe/compare/v1.0.5...v1.0.6) (2018-10-04)
7+
8+
9+
10+
<a name="1.0.5"></a>
11+
## [1.0.5](https://github.com/vue-a11y/vue-axe/compare/v1.0.4...v1.0.5) (2018-10-04)
12+
13+
14+
515
<a name="1.0.4"></a>
616
## [1.0.4](https://github.com/vue-a11y/vue-axe/compare/v1.0.3...v1.0.4) (2018-05-23)
717

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# vue-axe
22

3-
Accessibility auditing for Vue.js applications (Inspired by [dequelabs/react-axe](https://github.com/dequelabs/react-axe))
3+
Accessibility auditing for Vue.js applications by running [dequelabs/axe-core](https://github.com/dequelabs/axe-core/) validation on the page your viewing, `axe-core` will run 1 second after the last VueJS update (with a 5 seconds debounce max wait). Package inspired by [dequelabs/react-axe](https://github.com/dequelabs/react-axe).
44

55
## Install package
66
#### NPM
@@ -30,12 +30,13 @@ if (process.env.NODE_ENV !== 'production') {
3030
]
3131
}
3232
})
33-
Vue.config.productionTip = false
3433
}
3534
```
36-
37-
Optional: You can also pass settings through the second parameter at the time of installing the plugin, read about the object here:
38-
https://github.com/dequelabs/axe-core/blob/master/doc/API.md#api-name-axeconfigure
35+
#### Configuration
36+
|Key|Description|Default|Required|
37+
|---|---|---|---|
38+
|`clearConsoleOnUpdate`|Clears the console each time `vue-axe` runs|`true`|`false`|
39+
|`config`|Provide your Axe-core configuration: https://github.com/dequelabs/axe-core/blob/master/doc/API.md#api-name-axeconfigure| |`false`|
3940

4041
## Install in Nuxt.js
4142
Create plugin file `plugins/axe.js`
@@ -49,7 +50,6 @@ if (process.env.NODE_ENV !== 'production') {
4950
// your configuration data
5051
}
5152
})
52-
Vue.config.productionTip = false
5353
}
5454

5555
```

demo/README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@
55
## Build Setup
66

77
``` bash
8-
# install dependencies
8+
# install vue-axe dependencies (root project / parent directory)
9+
npm install
10+
11+
# build vue-axe
12+
npm run dist
13+
14+
# switch to demo folder
15+
cd demo
16+
17+
# install demo dependencies
918
npm install
1019

1120
# serve with hot reload at localhost:8080

demo/src/components/Logo.vue

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<template>
22
<div>
3-
<img :src="src" role="oisduhuo">
3+
<img v-if="showAlt" :src="src" role="oisduhuo" alt="VueJS Logo">
4+
<img v-else :src="src" role="oisduhuo">
45
</div>
56
</template>
67

78
<script>
89
export default {
910
name: 'Logo',
10-
props: ['src']
11+
props: ['src', 'showAlt']
1112
}
1213
</script>

demo/src/main.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import Vue from 'vue'
22
import App from './App.vue'
33
import router from './router.js'
44

5-
// Use this plugin only in development => if (process.env.NODE_ENV !== 'production')
6-
const VueAxe = require('../vue-axe')
5+
// Use this plugin only in development => if (process.env.NODE_ENV !== 'production')
6+
const VueAxe = require('../../dist/vue-axe')
77
Vue.use(VueAxe, {
88
config: {
99
rules: [

demo/src/pages/Home.vue

+29-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div>
3-
<logo :src="require('@/assets/logo.png')" />
3+
<logo :src="require('@/assets/logo.png')" :showAlt="showAlt" />
44
<h1 data-va="main header">{{ msg }}</h1>
55
<h2>Access Pages</h2>
66
<ul>
@@ -11,25 +11,50 @@
1111
<router-link to="/contact">Contact</router-link>
1212
</li>
1313
</ul>
14+
<!--<p>Number: {{num}}</p>-->
15+
<!--<p>Each time the number updates it's running a debounce function to call `axe-core` again.<br />It will only run run the debounce once per 5 seconds or 1 second after the last call.</p>-->
16+
<!--<p>Use this button to see the console update as you fix or break a11y rules.</p>-->
17+
<button v-if="!showAlt" @click="toggleLogoAltTag">Add an alt tag to the logo</button>
18+
<button v-else @click="toggleLogoAltTag">Remove the alt tag from the logo</button>
1419
</div>
1520
</template>
1621

1722
<script>
1823
import Logo from '@/components/Logo'
19-
24+
2025
export default {
2126
name: 'Home',
2227
components: {
2328
Logo
2429
},
2530
data () {
2631
return {
27-
msg: 'Welcome - Open your console'
32+
msg: 'Welcome - Open your console',
33+
// num: 0,
34+
showAlt: false
35+
}
36+
},
37+
// mounted()
38+
// {
39+
// this.updateNumber();
40+
// },
41+
methods: {
42+
// updateNumber()
43+
// {
44+
// setTimeout(() => {
45+
// this.num += 1;
46+
// this.updateNumber();
47+
// }, 500);
48+
// },
49+
toggleLogoAltTag()
50+
{
51+
this.showAlt = !this.showAlt
52+
// console.log('Wait for Axe to run again in 5 seconds')
2853
}
2954
}
3055
}
3156
</script>
3257

3358
<style scoped>
3459
35-
</style>
60+
</style>

dist/vue-axe.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)