axe-core-rspec 2.6.1.pre.0f0b25b → 4.0.0.pre.a442c75
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -33
- data/lib/axe-rspec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1a259ac25eddf46217c88bb29431b7679cf2879f5c4a9d55f73a9123fe791f8
|
4
|
+
data.tar.gz: 40a3a172c34c7a75887262f07b6fab5ef65f04afde9fe684c9fa71c618511017
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d985f3594303c5c26f0c6eedfb798d0f8dc277d305a1eb3bba277efa7dbf4246793e31acd86b17c95c08c938024aa28ad15f12bf59a55e4d48ae49fa9887dec6
|
7
|
+
data.tar.gz: b70bb2baa0e45df4b1bd99e32fd804c6d3b0174973f9549128cdcd650400e5442396a093a2837722c044495abdef96cd9aa5cbbca1394ff931a7744b7deb1dd4
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
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
|
|
@@ -14,7 +14,7 @@ source "https://rubygems.org"
|
|
14
14
|
gem 'axe-core-rspec'
|
15
15
|
```
|
16
16
|
|
17
|
-
- Simply requrire `axe-rspec` which extends `RSpec` with the custom matcher `
|
17
|
+
- Simply requrire `axe-rspec` which extends `RSpec` with the custom matcher `BeAxeClean` .
|
18
18
|
|
19
19
|
``` rb
|
20
20
|
require 'axe-rspec'
|
@@ -24,13 +24,13 @@ require 'axe-rspec'
|
|
24
24
|
|
25
25
|
## Matcher
|
26
26
|
|
27
|
-
###
|
27
|
+
### BeAxeClean
|
28
28
|
|
29
|
-
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.
|
30
30
|
|
31
31
|
#### Clauses
|
32
32
|
|
33
|
-
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.
|
34
34
|
|
35
35
|
##### `within` - Inclusion clause
|
36
36
|
|
@@ -42,24 +42,24 @@ Examples:
|
|
42
42
|
|
43
43
|
``` rb
|
44
44
|
# Simple selector
|
45
|
-
expect(page).to
|
45
|
+
expect(page).to be_axe_clean.within '#selector1'
|
46
46
|
|
47
47
|
# Compound selector
|
48
48
|
# Include all elements with the class 'selector2' inside the element with id 'selector1'
|
49
|
-
expect(page).to
|
49
|
+
expect(page).to be_axe_clean.within '#selector1 .selector2'
|
50
50
|
|
51
51
|
# Multiple selectors
|
52
52
|
# Include the element with id 'selector1' *and* all elements with class 'selector2'
|
53
|
-
expect(page).to
|
53
|
+
expect(page).to be_axe_clean.within '#selector1', '.selector2'
|
54
54
|
|
55
55
|
# IFrame selector
|
56
56
|
# Include the element with id 'selector1' inside the IFrame with id 'frame1'
|
57
|
-
expect(page).to
|
57
|
+
expect(page).to be_axe_clean.within iframe: '#frame1', selector: '#selector1'
|
58
58
|
|
59
59
|
# Multiple IFrame selectors
|
60
60
|
# Include the element with id 'selector1' inside the IFrame with id 'frame1'
|
61
61
|
# Include the element with id 'selector2' inside the IFrame with id 'frame2'
|
62
|
-
expect(page).to
|
62
|
+
expect(page).to be_axe_clean.within(
|
63
63
|
{iframe: '#frame1', selector: '#selector1'},
|
64
64
|
{iframe: '#frame2', selector: '#selector2'}
|
65
65
|
)
|
@@ -67,12 +67,12 @@ expect(page).to be_accessible.within(
|
|
67
67
|
# Simple selectors *and* IFrame selector
|
68
68
|
# Include the element with id 'selector1' *and* all elements with class 'selector2'
|
69
69
|
# Include the element with id 'selector3' inside the IFrame with id 'frame'
|
70
|
-
expect(page).to
|
70
|
+
expect(page).to be_axe_clean.within '#selector1', '.selector2', iframe: '#frame', selector: '#selector3'
|
71
71
|
|
72
72
|
# Nested IFrame selectors
|
73
73
|
# Include the element selector1 inside the IFrame with id 'frame2',
|
74
74
|
# inside the IFrame with id 'frame1'
|
75
|
-
expect(page).to
|
75
|
+
expect(page).to be_axe_clean.within(iframe: '#frame1', selector:
|
76
76
|
{iframe: '#frame2', selector: '#selector1'}
|
77
77
|
)
|
78
78
|
```
|
@@ -87,24 +87,24 @@ Examples:
|
|
87
87
|
|
88
88
|
```rb
|
89
89
|
# Simple selector
|
90
|
-
expect(page).to
|
90
|
+
expect(page).to be_axe_clean.excluding '#selector1'
|
91
91
|
|
92
92
|
# Compound selector
|
93
93
|
# Exclude all elements with the class 'selector2' inside the element with id 'selector1'
|
94
|
-
expect(page).to
|
94
|
+
expect(page).to be_axe_clean.excluding '#selector1 .selector2'
|
95
95
|
|
96
96
|
# Multiple selectors
|
97
97
|
# Exclude the element with id 'selector1' *and* all elements with class 'selector2'
|
98
|
-
expect(page).to
|
98
|
+
expect(page).to be_axe_clean.excluding '#selector1', '.selector2'
|
99
99
|
|
100
100
|
# IFrame selector
|
101
101
|
# Exclude the element with id 'selector1' inside the IFrame with id 'frame1'
|
102
|
-
expect(page).to
|
102
|
+
expect(page).to be_axe_clean.excluding iframe: '#frame1', selector: '#selector1'
|
103
103
|
|
104
104
|
# Multiple IFrame selectors
|
105
105
|
# Exclude the element with id 'selector1' inside the IFrame with id 'frame1'
|
106
106
|
# Exclude the element with id 'selector2' inside the IFrame with id 'frame2'
|
107
|
-
expect(page).to
|
107
|
+
expect(page).to be_axe_clean.excluding(
|
108
108
|
{iframe: '#frame1', selector: '#selector1'},
|
109
109
|
{iframe: '#frame2', selector: '#selector2'}
|
110
110
|
)
|
@@ -112,12 +112,12 @@ expect(page).to be_accessible.excluding(
|
|
112
112
|
# Simple selectors with IFrame selector
|
113
113
|
# Exclude the element with id 'selector1' *and* all elements with class 'selector2'
|
114
114
|
# Exclude the element with id 'selector3' inside the IFrame with id 'frame'
|
115
|
-
expect(page).to
|
115
|
+
expect(page).to be_axe_clean.excluding '#selector1', '.selector2', iframe: '#frame', selector: '#selector3'
|
116
116
|
|
117
117
|
# Nested IFrame selectors
|
118
118
|
# Exclude the element selector1 inside the IFrame with id 'frame2',
|
119
119
|
# inside the IFrame with id 'frame1'
|
120
|
-
expect(page).to
|
120
|
+
expect(page).to be_axe_clean.excluding(iframe: '#frame1', selector:
|
121
121
|
{iframe: '#frame2', selector: '#selector1'}
|
122
122
|
)
|
123
123
|
```
|
@@ -130,10 +130,10 @@ The acceptable [tag names are documented][options-param] as well as a [complete
|
|
130
130
|
|
131
131
|
```rb
|
132
132
|
# Single standard
|
133
|
-
expect(page).to
|
133
|
+
expect(page).to be_axe_clean.according_to :wcag2a
|
134
134
|
|
135
135
|
# Multiple standards
|
136
|
-
expect(page).to
|
136
|
+
expect(page).to be_axe_clean.according_to :wcag2a, :section508
|
137
137
|
```
|
138
138
|
|
139
139
|
##### `checking` - Checking Rules clause
|
@@ -144,13 +144,13 @@ The checking-rules clause specifies which *additional* rules to check (in additi
|
|
144
144
|
|
145
145
|
```rb
|
146
146
|
# Checking a single rule
|
147
|
-
expect(page).to
|
147
|
+
expect(page).to be_axe_clean.checking :label
|
148
148
|
|
149
149
|
# Checking multiple rules
|
150
|
-
expect(page).to
|
150
|
+
expect(page).to be_axe_clean.checking :label, :tabindex
|
151
151
|
|
152
152
|
# Example specifying an additional best practice rule in addition to all rules in the WCAG2A standard
|
153
|
-
expect(page).to
|
153
|
+
expect(page).to be_axe_clean.according_to(:wcag2a).checking(:tabindex)
|
154
154
|
```
|
155
155
|
|
156
156
|
##### `checking_only` - Exclusive Rules clause
|
@@ -159,10 +159,10 @@ The checking only rules clause specifies which rules to exclusively check. Using
|
|
159
159
|
|
160
160
|
```rb
|
161
161
|
# Checking a single rule
|
162
|
-
expect(page).to
|
162
|
+
expect(page).to be_axe_clean.checking_only :label
|
163
163
|
|
164
164
|
# Checking multiple rules
|
165
|
-
expect(page).to
|
165
|
+
expect(page).to be_axe_clean.checking_only :label, :tabindex
|
166
166
|
```
|
167
167
|
|
168
168
|
##### `skipping` - Skipping Rules clause
|
@@ -173,13 +173,13 @@ The skipping-rules clause specifies which rules to skip. This allows an accessib
|
|
173
173
|
|
174
174
|
```rb
|
175
175
|
# Skipping a single rule
|
176
|
-
expect(page).to
|
176
|
+
expect(page).to be_axe_clean.skipping :label
|
177
177
|
|
178
178
|
# Skipping multiple rules
|
179
|
-
expect(page).to
|
179
|
+
expect(page).to be_axe_clean.skipping :label, :tabindex
|
180
180
|
|
181
181
|
# Example specifying an additional best practice rule in addition to all rules in the WCAG2A standard
|
182
|
-
expect(page).to
|
182
|
+
expect(page).to be_axe_clean.according_to(:wcag2a).skipping(:label)
|
183
183
|
```
|
184
184
|
|
185
185
|
##### Interoperability between clauses
|
@@ -187,13 +187,13 @@ expect(page).to be_accessible.according_to(:wcag2a).skipping(:label)
|
|
187
187
|
All of the described clauses may be mixed and matched with method chaining. Below are some examples.
|
188
188
|
|
189
189
|
```rb
|
190
|
-
expect(page).to
|
190
|
+
expect(page).to be_axe_clean.within('.main', '.header').excluding('.footer')
|
191
191
|
|
192
|
-
expect(page).to
|
192
|
+
expect(page).to be_axe_clean.excluding('#sidebar').according_to(:wcag2a, :wcag2aa).skipping(:color-contrast)
|
193
193
|
|
194
|
-
expect(page).to
|
194
|
+
expect(page).to be_axe_clean.within('.main').checking_only :document-title, :label
|
195
195
|
|
196
|
-
expect(page).to
|
196
|
+
expect(page).to be_axe_clean.according_to(:best-practice).checking(:aria-roles, :definition-list)
|
197
197
|
```
|
198
198
|
|
199
199
|
[context-param]: https://github.com/dequelabs/axe-core/blob/master/doc/API.md#context-parameter
|
data/lib/axe-rspec.rb
CHANGED