axe-core-rspec 2.6.1.pre.a3ba8a2 → 4.0.0.pre.41da1f0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +44 -34
- data/lib/axe-rspec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4387dc5ecb989a7a88466559f01f66a1cf9604d1e087ec8d125c67ed668006c0
|
4
|
+
data.tar.gz: '0303260953ef1881af571e98ba480ccec56b07518bd888a64ed66797f5a1f351'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb4e2ba979e67626cdee3cf4ec50300e8e7d2799c205fd3b6dd62bf2e359b78d17131cbf31589571216e01d869cde6ea7f3c8ac33c0bd19d335b7439cdafa7d8
|
7
|
+
data.tar.gz: a80f39fd0eafad84a274d9d92031adea7e011890b3c36db60aaece24ed6ef13df79636885a74e4ec7564e6291ad551fab5ff4ed25c44f90a24baac1b4bb2bb7c
|
data/README.md
CHANGED
@@ -1,26 +1,36 @@
|
|
1
1
|
# `axe-core-rspec`
|
2
2
|
|
3
|
-
The `axe-core-rspec` gem provides a custom matchers `
|
3
|
+
The `axe-core-rspec` gem provides a custom matchers `BeAxeClean` , which can be instantiated using the `be_axe_clean` helper method.
|
4
4
|
|
5
5
|
> See a list of [RSpec built-in matchers](https://relishapp.com/rspec/rspec-expectations/docs/built-in-matchers)
|
6
6
|
|
7
7
|
## Usage
|
8
8
|
|
9
|
-
|
9
|
+
- In your Gemfile, add the `axe-core-rspec` gem.
|
10
|
+
|
11
|
+
```Gemfile
|
12
|
+
source "https://rubygems.org"
|
13
|
+
|
14
|
+
gem 'axe-core-rspec'
|
15
|
+
```
|
16
|
+
|
17
|
+
- Simply requrire `axe-rspec` which extends `RSpec` with the custom matcher `BeAxeClean` .
|
10
18
|
|
11
19
|
``` rb
|
12
|
-
require 'axe-
|
20
|
+
require 'axe-rspec'
|
13
21
|
```
|
14
22
|
|
23
|
+
- Use with webdriver of choice.
|
24
|
+
|
15
25
|
## Matcher
|
16
26
|
|
17
|
-
###
|
27
|
+
### BeAxeClean
|
18
28
|
|
19
|
-
To construct an axe accessibility RSpec check, begin with `expect(page).to
|
29
|
+
To construct an axe accessibility RSpec check, begin with `expect(page).to be_axe_clean` , and append any clauses necessary, where `page` object is provided by the webdriver of choice.
|
20
30
|
|
21
31
|
#### Clauses
|
22
32
|
|
23
|
-
Clauses are chainable methods for the `
|
33
|
+
Clauses are chainable methods for the `be_axe_clean` custom matcher.Configurable clauses allows for greater granularity with testing and expectaions.
|
24
34
|
|
25
35
|
##### `within` - Inclusion clause
|
26
36
|
|
@@ -32,24 +42,24 @@ Examples:
|
|
32
42
|
|
33
43
|
``` rb
|
34
44
|
# Simple selector
|
35
|
-
expect(page).to
|
45
|
+
expect(page).to be_axe_clean.within '#selector1'
|
36
46
|
|
37
47
|
# Compound selector
|
38
48
|
# Include all elements with the class 'selector2' inside the element with id 'selector1'
|
39
|
-
expect(page).to
|
49
|
+
expect(page).to be_axe_clean.within '#selector1 .selector2'
|
40
50
|
|
41
51
|
# Multiple selectors
|
42
52
|
# Include the element with id 'selector1' *and* all elements with class 'selector2'
|
43
|
-
expect(page).to
|
53
|
+
expect(page).to be_axe_clean.within '#selector1', '.selector2'
|
44
54
|
|
45
55
|
# IFrame selector
|
46
56
|
# Include the element with id 'selector1' inside the IFrame with id 'frame1'
|
47
|
-
expect(page).to
|
57
|
+
expect(page).to be_axe_clean.within iframe: '#frame1', selector: '#selector1'
|
48
58
|
|
49
59
|
# Multiple IFrame selectors
|
50
60
|
# Include the element with id 'selector1' inside the IFrame with id 'frame1'
|
51
61
|
# Include the element with id 'selector2' inside the IFrame with id 'frame2'
|
52
|
-
expect(page).to
|
62
|
+
expect(page).to be_axe_clean.within(
|
53
63
|
{iframe: '#frame1', selector: '#selector1'},
|
54
64
|
{iframe: '#frame2', selector: '#selector2'}
|
55
65
|
)
|
@@ -57,12 +67,12 @@ expect(page).to be_accessible.within(
|
|
57
67
|
# Simple selectors *and* IFrame selector
|
58
68
|
# Include the element with id 'selector1' *and* all elements with class 'selector2'
|
59
69
|
# Include the element with id 'selector3' inside the IFrame with id 'frame'
|
60
|
-
expect(page).to
|
70
|
+
expect(page).to be_axe_clean.within '#selector1', '.selector2', iframe: '#frame', selector: '#selector3'
|
61
71
|
|
62
72
|
# Nested IFrame selectors
|
63
73
|
# Include the element selector1 inside the IFrame with id 'frame2',
|
64
74
|
# inside the IFrame with id 'frame1'
|
65
|
-
expect(page).to
|
75
|
+
expect(page).to be_axe_clean.within(iframe: '#frame1', selector:
|
66
76
|
{iframe: '#frame2', selector: '#selector1'}
|
67
77
|
)
|
68
78
|
```
|
@@ -77,24 +87,24 @@ Examples:
|
|
77
87
|
|
78
88
|
```rb
|
79
89
|
# Simple selector
|
80
|
-
expect(page).to
|
90
|
+
expect(page).to be_axe_clean.excluding '#selector1'
|
81
91
|
|
82
92
|
# Compound selector
|
83
93
|
# Exclude all elements with the class 'selector2' inside the element with id 'selector1'
|
84
|
-
expect(page).to
|
94
|
+
expect(page).to be_axe_clean.excluding '#selector1 .selector2'
|
85
95
|
|
86
96
|
# Multiple selectors
|
87
97
|
# Exclude the element with id 'selector1' *and* all elements with class 'selector2'
|
88
|
-
expect(page).to
|
98
|
+
expect(page).to be_axe_clean.excluding '#selector1', '.selector2'
|
89
99
|
|
90
100
|
# IFrame selector
|
91
101
|
# Exclude the element with id 'selector1' inside the IFrame with id 'frame1'
|
92
|
-
expect(page).to
|
102
|
+
expect(page).to be_axe_clean.excluding iframe: '#frame1', selector: '#selector1'
|
93
103
|
|
94
104
|
# Multiple IFrame selectors
|
95
105
|
# Exclude the element with id 'selector1' inside the IFrame with id 'frame1'
|
96
106
|
# Exclude the element with id 'selector2' inside the IFrame with id 'frame2'
|
97
|
-
expect(page).to
|
107
|
+
expect(page).to be_axe_clean.excluding(
|
98
108
|
{iframe: '#frame1', selector: '#selector1'},
|
99
109
|
{iframe: '#frame2', selector: '#selector2'}
|
100
110
|
)
|
@@ -102,12 +112,12 @@ expect(page).to be_accessible.excluding(
|
|
102
112
|
# Simple selectors with IFrame selector
|
103
113
|
# Exclude the element with id 'selector1' *and* all elements with class 'selector2'
|
104
114
|
# Exclude the element with id 'selector3' inside the IFrame with id 'frame'
|
105
|
-
expect(page).to
|
115
|
+
expect(page).to be_axe_clean.excluding '#selector1', '.selector2', iframe: '#frame', selector: '#selector3'
|
106
116
|
|
107
117
|
# Nested IFrame selectors
|
108
118
|
# Exclude the element selector1 inside the IFrame with id 'frame2',
|
109
119
|
# inside the IFrame with id 'frame1'
|
110
|
-
expect(page).to
|
120
|
+
expect(page).to be_axe_clean.excluding(iframe: '#frame1', selector:
|
111
121
|
{iframe: '#frame2', selector: '#selector1'}
|
112
122
|
)
|
113
123
|
```
|
@@ -120,10 +130,10 @@ The acceptable [tag names are documented][options-param] as well as a [complete
|
|
120
130
|
|
121
131
|
```rb
|
122
132
|
# Single standard
|
123
|
-
expect(page).to
|
133
|
+
expect(page).to be_axe_clean.according_to :wcag2a
|
124
134
|
|
125
135
|
# Multiple standards
|
126
|
-
expect(page).to
|
136
|
+
expect(page).to be_axe_clean.according_to :wcag2a, :section508
|
127
137
|
```
|
128
138
|
|
129
139
|
##### `checking` - Checking Rules clause
|
@@ -134,13 +144,13 @@ The checking-rules clause specifies which *additional* rules to check (in additi
|
|
134
144
|
|
135
145
|
```rb
|
136
146
|
# Checking a single rule
|
137
|
-
expect(page).to
|
147
|
+
expect(page).to be_axe_clean.checking :label
|
138
148
|
|
139
149
|
# Checking multiple rules
|
140
|
-
expect(page).to
|
150
|
+
expect(page).to be_axe_clean.checking :label, :tabindex
|
141
151
|
|
142
152
|
# Example specifying an additional best practice rule in addition to all rules in the WCAG2A standard
|
143
|
-
expect(page).to
|
153
|
+
expect(page).to be_axe_clean.according_to(:wcag2a).checking(:tabindex)
|
144
154
|
```
|
145
155
|
|
146
156
|
##### `checking_only` - Exclusive Rules clause
|
@@ -149,10 +159,10 @@ The checking only rules clause specifies which rules to exclusively check. Using
|
|
149
159
|
|
150
160
|
```rb
|
151
161
|
# Checking a single rule
|
152
|
-
expect(page).to
|
162
|
+
expect(page).to be_axe_clean.checking_only :label
|
153
163
|
|
154
164
|
# Checking multiple rules
|
155
|
-
expect(page).to
|
165
|
+
expect(page).to be_axe_clean.checking_only :label, :tabindex
|
156
166
|
```
|
157
167
|
|
158
168
|
##### `skipping` - Skipping Rules clause
|
@@ -163,13 +173,13 @@ The skipping-rules clause specifies which rules to skip. This allows an accessib
|
|
163
173
|
|
164
174
|
```rb
|
165
175
|
# Skipping a single rule
|
166
|
-
expect(page).to
|
176
|
+
expect(page).to be_axe_clean.skipping :label
|
167
177
|
|
168
178
|
# Skipping multiple rules
|
169
|
-
expect(page).to
|
179
|
+
expect(page).to be_axe_clean.skipping :label, :tabindex
|
170
180
|
|
171
181
|
# Example specifying an additional best practice rule in addition to all rules in the WCAG2A standard
|
172
|
-
expect(page).to
|
182
|
+
expect(page).to be_axe_clean.according_to(:wcag2a).skipping(:label)
|
173
183
|
```
|
174
184
|
|
175
185
|
##### Interoperability between clauses
|
@@ -177,13 +187,13 @@ expect(page).to be_accessible.according_to(:wcag2a).skipping(:label)
|
|
177
187
|
All of the described clauses may be mixed and matched with method chaining. Below are some examples.
|
178
188
|
|
179
189
|
```rb
|
180
|
-
expect(page).to
|
190
|
+
expect(page).to be_axe_clean.within('.main', '.header').excluding('.footer')
|
181
191
|
|
182
|
-
expect(page).to
|
192
|
+
expect(page).to be_axe_clean.excluding('#sidebar').according_to(:wcag2a, :wcag2aa).skipping(:color-contrast)
|
183
193
|
|
184
|
-
expect(page).to
|
194
|
+
expect(page).to be_axe_clean.within('.main').checking_only :document-title, :label
|
185
195
|
|
186
|
-
expect(page).to
|
196
|
+
expect(page).to be_axe_clean.according_to(:best-practice).checking(:aria-roles, :definition-list)
|
187
197
|
```
|
188
198
|
|
189
199
|
[context-param]: https://github.com/dequelabs/axe-core/blob/master/doc/API.md#context-parameter
|
data/lib/axe-rspec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: axe-core-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0.pre.41da1f0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Deque Systems
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dumb_delegator
|