bbc-a11y 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -0
- data/CONTRIBUTING.md +70 -8
- data/GETTINGSTARTED.md +65 -0
- data/LICENSE +1 -1
- data/README.md +12 -55
- data/Rakefile +1 -1
- data/a11y.rb +1 -3
- data/bbc-a11y.gemspec +0 -1
- data/features/check_standards/01_core_purpose.feature +39 -0
- data/features/check_standards/02_validation.feature +1 -0
- data/features/check_standards/03_progressive_enhancement.feature +3 -0
- data/features/check_standards/{language.feature → 04_indicating_language.feature} +2 -2
- data/features/check_standards/05_page_titles.feature +1 -0
- data/features/check_standards/{main_landmark.feature → 06_main_landmark.feature} +6 -6
- data/features/check_standards/07_headings.feature +222 -0
- data/features/check_standards/{minimum_text_size.feature → 08_minimum_text_size.feature} +22 -2
- data/features/check_standards/09_resizable_text.feature +2 -0
- data/features/check_standards/{tab_index.feature → 10_tab_index.feature} +7 -7
- data/features/check_standards/{title_attribute.feature → 11_title_attributes.feature} +13 -5
- data/features/check_standards/{focusable_controls.feature → 12_focusable_controls.feature} +4 -4
- data/features/check_standards/13_visible_on_focus.feature +1 -0
- data/features/check_standards/14_control_styles.feature +1 -0
- data/features/check_standards/15_focus_styles.feature +1 -0
- data/features/check_standards/16_colour_contrast.feature +1 -0
- data/features/check_standards/17_colour_and_meaning.feature +1 -0
- data/features/check_standards/{image_alt.feature → 18_image_alternatives.feature} +5 -5
- data/features/check_standards/{form_labels.feature → 19_form_labels.feature} +7 -7
- data/features/check_standards/{form_interactions.feature → 20_form_interactions.feature} +6 -6
- data/features/check_standards/21_tables.feature +1 -0
- data/features/cli/display_failing_result.feature +14 -1
- data/features/cli/display_result_summary.feature +15 -1
- data/features/cli/provide_muting_tips.feature +1 -1
- data/features/cli/skipping_standards.feature +1 -1
- data/features/mute_errors.feature +2 -2
- data/features/step_definitions/steps.rb +10 -9
- data/features/support/web_server.rb +0 -11
- data/features/support/web_server/blank.html +7 -0
- data/features/support/web_server/two_headings_failures.html +11 -0
- data/karma.conf.js +1 -1
- data/lib/bbc/a11y/cli.rb +33 -6
- data/lib/bbc/a11y/js/bundle.js +139 -89
- data/lib/bbc/a11y/js/standards.js +67 -20
- data/lib/bbc/a11y/js/standards/{anchorsMustHaveHrefs.js → focusableControls/anchorsMustHaveHrefs.js} +0 -0
- data/lib/bbc/a11y/js/standards/{formsMustHaveSubmitButtons.js → formInteractions/formsMustHaveSubmitButtons.js} +0 -0
- data/lib/bbc/a11y/js/standards/{fieldsMustHaveLabelsOrTitles.js → formLabels/fieldsMustHaveLabelsOrTitles.js} +0 -0
- data/lib/bbc/a11y/js/standards/headings/contentMustFollowHeadings.js +18 -0
- data/lib/bbc/a11y/js/standards/{exactlyOneMainHeading.js → headings/exactlyOneMainHeading.js} +1 -1
- data/lib/bbc/a11y/js/standards/{headingsMustBeInAscendingOrder.js → headings/headingsMustBeInAscendingOrder.js} +0 -0
- data/lib/bbc/a11y/js/standards/{imagesMustHaveAltAttributes.js → imageAlternatives/imagesMustHaveAltAttributes.js} +0 -0
- data/lib/bbc/a11y/js/standards/{htmlMustHaveLangAttribute.js → indicatingLanguage/htmlMustHaveLangAttribute.js} +0 -0
- data/lib/bbc/a11y/js/standards/{exactlyOneMainLandmark.js → mainLandmark/exactlyOneMainLandmark.js} +0 -0
- data/lib/bbc/a11y/js/standards/{minimumTextSize.js → minimumTextSize/textCannotBeTooSmall.js} +3 -3
- data/lib/bbc/a11y/js/standards/{elementsWithZeroTabIndexMustBeFields.js → tabIndex/elementsWithZeroTabIndexMustBeFields.js} +0 -0
- data/lib/bbc/a11y/js/standards/{titleAttributesOnlyOnInputs.js → titleAttributes/titleAttributesOnlyOnInputs.js} +1 -1
- data/lib/bbc/a11y/linter.rb +16 -4
- data/lib/bbc/a11y/runner.rb +0 -1
- data/lib/bbc/a11y/string_colours.rb +15 -0
- data/lib/bbc/a11y/version +1 -1
- data/package.json +3 -0
- data/spec/bbc/a11y/js/a11ySpec.js +15 -6
- data/spec/bbc/a11y/js/minimumTextSizeStandardSpec.js +25 -0
- data/spec/bbc/a11y/js/standardsSpec.js +6 -6
- data/spec/bbc/a11y/string_colours_spec.rb +13 -0
- metadata +68 -102
- data/circle.yml +0 -3
- data/examples/bbc-pages/Gemfile +0 -3
- data/examples/bbc-pages/Rakefile +0 -3
- data/examples/bbc-pages/a11y.rb +0 -2
- data/examples/local-web-app/Gemfile +0 -4
- data/examples/local-web-app/Rakefile +0 -3
- data/examples/local-web-app/a11y.rb +0 -52
- data/examples/local-web-app/config.ru +0 -1
- data/examples/local-web-app/public/missing_header.html +0 -13
- data/examples/local-web-app/public/perfect.html +0 -14
- data/examples/local-web-app/readme.md +0 -0
- data/features/check_standards/headings.feature +0 -153
- data/lib/bbc/a11y/js/standards/contentMustFollowHeadings.js +0 -15
- data/lib/bbc/a11y/standards.rb +0 -45
- data/lib/bbc/a11y/standards/anchor_hrefs.rb +0 -18
- data/lib/bbc/a11y/standards/content_follows_headings.rb +0 -22
- data/lib/bbc/a11y/standards/exactly_one_main_heading.rb +0 -25
- data/lib/bbc/a11y/standards/exactly_one_main_landmark.rb +0 -20
- data/lib/bbc/a11y/standards/form_labels.rb +0 -39
- data/lib/bbc/a11y/standards/form_submit_buttons.rb +0 -21
- data/lib/bbc/a11y/standards/heading_hierarchy.rb +0 -34
- data/lib/bbc/a11y/standards/image_alt.rb +0 -18
- data/lib/bbc/a11y/standards/language_attribute.rb +0 -19
- data/lib/bbc/a11y/standards/tab_index.rb +0 -22
- data/lib/bbc/a11y/standards/title_attribute.rb +0 -31
- data/standards/01_core-purpose.md +0 -24
- data/standards/02_validation.feature +0 -31
- data/standards/03_javascript.feature +0 -40
- data/standards/04_language.feature +0 -58
- data/standards/05_page_title.feature +0 -45
- data/standards/06_main_landmark.feature +0 -24
- data/standards/07_headings.feature +0 -65
- data/standards/08_title_attribute.feature +0 -71
- data/standards/09_tabindex.feature +0 -51
- data/standards/10_form_labels.feature +0 -88
- data/standards/11_visible-on-focus.md +0 -58
- data/standards/13_colour-contrast.md +0 -27
- data/standards/14_colour-meaning.md +0 -19
- data/standards/15_focusable-controls.md +0 -45
- data/standards/16_table.md +0 -109
- data/standards/17_control-styles.md +0 -78
- data/standards/18_focus-styles.md +0 -36
- data/standards/19_form-interactions.md +0 -33
- data/standards/20_image-alt.md +0 -34
- data/standards/21_min-font-sizes.md +0 -64
- data/standards/22_resize-zoom.md +0 -80
- data/standards/step_definitions/core_content_steps.rb +0 -3
- data/standards/step_definitions/form_steps.rb +0 -6
- data/standards/step_definitions/language_steps.rb +0 -21
- data/standards/step_definitions/page_steps.rb +0 -50
- data/standards/step_definitions/w3c_steps.rb +0 -7
- data/standards/support/capybara.rb +0 -53
- data/standards/support/skipper.rb +0 -5
- data/standards/support/world.rb +0 -3
- data/standards/support/world_extender.rb +0 -5
@@ -13,7 +13,7 @@ Feature: Minimum text size
|
|
13
13
|
with browser tools to resize content.
|
14
14
|
|
15
15
|
Scenario: Small text
|
16
|
-
Given a page with the
|
16
|
+
Given a page with the body:
|
17
17
|
"""
|
18
18
|
<style>
|
19
19
|
body {
|
@@ -26,7 +26,7 @@ Feature: Minimum text size
|
|
26
26
|
</style>
|
27
27
|
<span>Some text</span> with <span>more <b>text</b> also</span>.
|
28
28
|
"""
|
29
|
-
When I validate the "
|
29
|
+
When I validate the "Minimum text size: text cannot be too small" standard
|
30
30
|
Then it fails with the message:
|
31
31
|
"""
|
32
32
|
Text size too small (10px): /html/body
|
@@ -34,3 +34,23 @@ Feature: Minimum text size
|
|
34
34
|
Text size too small (10px): /html/body/span[2]
|
35
35
|
Text size too small (9px): /html/body/span[2]/b
|
36
36
|
"""
|
37
|
+
|
38
|
+
Scenario: Hidden elements with small text
|
39
|
+
Given a page with the body:
|
40
|
+
"""
|
41
|
+
<style>
|
42
|
+
span { display: none; }
|
43
|
+
</style>
|
44
|
+
<span style="font-size: 1px">Tiny text, but it's hidden!</span>
|
45
|
+
"""
|
46
|
+
When I validate the "Minimum text size: text cannot be too small" standard
|
47
|
+
Then it passes
|
48
|
+
|
49
|
+
Scenario: Text nodes with only whitespace
|
50
|
+
Given a page with the body:
|
51
|
+
"""
|
52
|
+
<div id="blq-global" style="font-size: 1px"> <div id="blq-pre-mast"> </div>
|
53
|
+
</div>
|
54
|
+
"""
|
55
|
+
When I validate the "Minimum text size: text cannot be too small" standard
|
56
|
+
Then it passes
|
@@ -1,4 +1,4 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: Tab Index
|
2
2
|
|
3
3
|
Positive `tabindex` attribute values **must not** be used to create a logical tab order.
|
4
4
|
|
@@ -18,17 +18,17 @@ Feature: Correctly use `tabindex` attributes
|
|
18
18
|
control such as a `<a>` or `<button>`.
|
19
19
|
|
20
20
|
Scenario: Element with negative tab index
|
21
|
-
Given a page with the
|
21
|
+
Given a page with the body:
|
22
22
|
"""
|
23
23
|
<a href="/news">News</a>
|
24
24
|
<button type="submit">Search</button>
|
25
25
|
<div tabindex="-1"></div>
|
26
26
|
"""
|
27
|
-
When I validate the "elements with zero tab index must be fields" standard
|
27
|
+
When I validate the "Tab index: elements with zero tab index must be fields" standard
|
28
28
|
Then it passes
|
29
29
|
|
30
30
|
Scenario: Focusable elements with zero tab index
|
31
|
-
Given a page with the
|
31
|
+
Given a page with the body:
|
32
32
|
"""
|
33
33
|
<a href="/news" tabindex="0">News</a>
|
34
34
|
<button tabindex="0">Search</button>
|
@@ -36,18 +36,18 @@ Feature: Correctly use `tabindex` attributes
|
|
36
36
|
<select tabindex="0"></select>
|
37
37
|
<textarea tabindex="0"></textarea>
|
38
38
|
"""
|
39
|
-
When I validate the "elements with zero tab index must be fields" standard
|
39
|
+
When I validate the "Tab index: elements with zero tab index must be fields" standard
|
40
40
|
Then it passes
|
41
41
|
|
42
42
|
Scenario: Unfocusable element with zero tab index
|
43
|
-
Given a page with the
|
43
|
+
Given a page with the body:
|
44
44
|
"""
|
45
45
|
<a href="/news" tabindex="1">News</a>
|
46
46
|
<button type="submit" tabindex="2">Search</button>
|
47
47
|
<div tabindex="3"></div>
|
48
48
|
<div tabindex="0"></div>
|
49
49
|
"""
|
50
|
-
When I validate the "elements with zero tab index must be fields" standard
|
50
|
+
When I validate the "Tab index: elements with zero tab index must be fields" standard
|
51
51
|
Then it fails with the message:
|
52
52
|
"""
|
53
53
|
Non-field element with tabindex=0: /html/body/div[2]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: Title Attributes
|
2
2
|
|
3
3
|
`title` attributes **must not** be used for critical information and **must not** repeat content that is already visible and associated with the same control or content.
|
4
4
|
|
@@ -17,23 +17,31 @@ Feature: Correctly use `title` attributes
|
|
17
17
|
- Do not use `title` attributes and explicit labels together on form fields
|
18
18
|
|
19
19
|
Scenario: Form field with title attribute
|
20
|
-
Given a page with the
|
20
|
+
Given a page with the body:
|
21
21
|
"""
|
22
22
|
<button type="button" title="Close Button">
|
23
23
|
<img src="close.png" />
|
24
24
|
</button>
|
25
25
|
"""
|
26
|
-
When I validate the "title attributes only on inputs" standard
|
26
|
+
When I validate the "Title attributes: title attributes only on inputs" standard
|
27
|
+
Then it passes
|
28
|
+
|
29
|
+
Scenario: Hidden element with title attribute
|
30
|
+
Given a page with the body:
|
31
|
+
"""
|
32
|
+
<iframe style="display:none" title="Ignore me, I'm invisible"></iframe>
|
33
|
+
"""
|
34
|
+
When I validate the "Title attributes: title attributes only on inputs" standard
|
27
35
|
Then it passes
|
28
36
|
|
29
37
|
Scenario: Anchor tag with title attribute
|
30
|
-
Given a page with the
|
38
|
+
Given a page with the body:
|
31
39
|
"""
|
32
40
|
<a href="close" title="Close Button">
|
33
41
|
<img src="close.png" />
|
34
42
|
</a>
|
35
43
|
"""
|
36
|
-
When I validate the "title attributes only on inputs" standard
|
44
|
+
When I validate the "Title attributes: title attributes only on inputs" standard
|
37
45
|
Then it fails with the message:
|
38
46
|
"""
|
39
47
|
Non-input element has title attribute: /html/body/a
|
@@ -33,7 +33,7 @@ Feature: Focusable Controls
|
|
33
33
|
causing confusion to users.
|
34
34
|
|
35
35
|
Scenario: All anchor tags have href attributes
|
36
|
-
Given a page with the
|
36
|
+
Given a page with the body:
|
37
37
|
"""
|
38
38
|
<button type="button">Open panel</button>
|
39
39
|
<ul>
|
@@ -42,11 +42,11 @@ Feature: Focusable Controls
|
|
42
42
|
<li><a href="#entertainmenttab">Entertainment</a></li>
|
43
43
|
</ul>
|
44
44
|
"""
|
45
|
-
When I validate the "anchors must have hrefs" standard
|
45
|
+
When I validate the "Focusable controls: anchors must have hrefs" standard
|
46
46
|
Then it passes
|
47
47
|
|
48
48
|
Scenario: Some anchor tags do not have href attributes
|
49
|
-
Given a page with the
|
49
|
+
Given a page with the body:
|
50
50
|
"""
|
51
51
|
<ul>
|
52
52
|
<li><a>News</a></li>
|
@@ -54,7 +54,7 @@ Feature: Focusable Controls
|
|
54
54
|
<li><a>Entertainment</a></li>
|
55
55
|
</ul>
|
56
56
|
"""
|
57
|
-
When I validate the "anchors must have hrefs" standard
|
57
|
+
When I validate the "Focusable controls: anchors must have hrefs" standard
|
58
58
|
Then it fails with the message:
|
59
59
|
"""
|
60
60
|
Anchor has no href attribute: /html/body/ul/li[1]/a
|
@@ -0,0 +1 @@
|
|
1
|
+
Feature: Visible On Focus
|
@@ -0,0 +1 @@
|
|
1
|
+
Feature: Control Styles
|
@@ -0,0 +1 @@
|
|
1
|
+
Feature: Focus Styles
|
@@ -0,0 +1 @@
|
|
1
|
+
Feature: Colour Contrast
|
@@ -0,0 +1 @@
|
|
1
|
+
Feature: Colour And Meaning
|
@@ -1,4 +1,4 @@
|
|
1
|
-
Feature: Image
|
1
|
+
Feature: Image Alternatives
|
2
2
|
|
3
3
|
All images **must** have an alt attribute.
|
4
4
|
|
@@ -18,21 +18,21 @@ Feature: Image alternative content
|
|
18
18
|
the value of the alt attribute or in the immediately surrounding text content.
|
19
19
|
|
20
20
|
Scenario: Images with alt attributes
|
21
|
-
Given a page with the
|
21
|
+
Given a page with the body:
|
22
22
|
"""
|
23
23
|
<img src="a.jpeg" alt="A picture of something" />
|
24
24
|
<img src="b.jpeg" alt="" />
|
25
25
|
"""
|
26
|
-
When I validate the "images must have alt attributes" standard
|
26
|
+
When I validate the "Image alternatives: images must have alt attributes" standard
|
27
27
|
Then it passes
|
28
28
|
|
29
29
|
Scenario: Images without alt attributes
|
30
|
-
Given a page with the
|
30
|
+
Given a page with the body:
|
31
31
|
"""
|
32
32
|
<img src="a.jpeg" alt="A picture of something" />
|
33
33
|
<img src="b.jpeg" />
|
34
34
|
"""
|
35
|
-
When I validate the "images must have alt attributes" standard
|
35
|
+
When I validate the "Image alternatives: images must have alt attributes" standard
|
36
36
|
Then it fails with the message:
|
37
37
|
"""
|
38
38
|
Image has no alt attribute: /html/body/img[2]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
Feature:
|
1
|
+
Feature: Form Labels
|
2
2
|
|
3
3
|
Form fields that allow input (`select`, and `textarea` elements, and all
|
4
4
|
`input` element types other than image, submit, reset, button, or hidden)
|
@@ -17,7 +17,7 @@ Feature: Correctly use form labels
|
|
17
17
|
reasonably expect to be able to use.
|
18
18
|
|
19
19
|
Scenario: All fields have labels or title attributes
|
20
|
-
Given a page with the
|
20
|
+
Given a page with the body:
|
21
21
|
"""
|
22
22
|
<label for="search">Search the BBC</label>
|
23
23
|
<input type="text" id="search" name="q" />
|
@@ -29,11 +29,11 @@ Feature: Correctly use form labels
|
|
29
29
|
|
30
30
|
<input type="text" name="q" title="Search the BBC" />
|
31
31
|
"""
|
32
|
-
When I validate the "fields must have labels or titles" standard
|
32
|
+
When I validate the "Form labels: fields must have labels or titles" standard
|
33
33
|
Then it passes
|
34
34
|
|
35
35
|
Scenario: Some fields without labels or title attributes
|
36
|
-
Given a page with the
|
36
|
+
Given a page with the body:
|
37
37
|
"""
|
38
38
|
<input type="text" name="name" title="Name" />
|
39
39
|
<input type="email" name="email" title="Email" />
|
@@ -44,7 +44,7 @@ Feature: Correctly use form labels
|
|
44
44
|
<input type="text" name="q" aria-label="Search the BBC" />
|
45
45
|
<input type="text" name="q" placeholder="Search the BBC" />
|
46
46
|
"""
|
47
|
-
When I validate the "fields must have labels or titles" standard
|
47
|
+
When I validate the "Form labels: fields must have labels or titles" standard
|
48
48
|
Then it fails with the message:
|
49
49
|
"""
|
50
50
|
Field has no label or title attribute: /html/body/textarea
|
@@ -56,9 +56,9 @@ Feature: Correctly use form labels
|
|
56
56
|
|
57
57
|
Scenario: Hidden fields do not need titles
|
58
58
|
|
59
|
-
Given a page with the
|
59
|
+
Given a page with the body:
|
60
60
|
"""
|
61
61
|
<input type=hidden name=a value=b>
|
62
62
|
"""
|
63
|
-
When I validate the "fields must have labels or titles" standard
|
63
|
+
When I validate the "Form labels: fields must have labels or titles" standard
|
64
64
|
Then it passes
|
@@ -19,7 +19,7 @@ Feature: Form Interactions
|
|
19
19
|
beneficial to low vision users as an indication of the end of the form.
|
20
20
|
|
21
21
|
Scenario: Form with a submit input
|
22
|
-
Given a page with the
|
22
|
+
Given a page with the body:
|
23
23
|
"""
|
24
24
|
<form action="/search">
|
25
25
|
<label for="q">Search term:</label>
|
@@ -27,24 +27,24 @@ Feature: Form Interactions
|
|
27
27
|
<input type="submit" value="Search">
|
28
28
|
</form>
|
29
29
|
"""
|
30
|
-
When I validate the "forms must have submit buttons" standard
|
30
|
+
When I validate the "Form interactions: forms must have submit buttons" standard
|
31
31
|
Then it passes
|
32
32
|
|
33
33
|
Scenario: Form with no submit button
|
34
|
-
Given a page with the
|
34
|
+
Given a page with the body:
|
35
35
|
"""
|
36
36
|
<form action="/search">
|
37
37
|
<label for="q">Search term:</label>
|
38
38
|
<input type="text" name="q" id="q">
|
39
39
|
</form>
|
40
40
|
"""
|
41
|
-
When I validate the "forms must have submit buttons" standard
|
41
|
+
When I validate the "Form interactions: forms must have submit buttons" standard
|
42
42
|
Then it fails with the message:
|
43
43
|
"""
|
44
44
|
Form has no submit button: /html/body/form
|
45
45
|
"""
|
46
46
|
Scenario: Form with a submit button
|
47
|
-
Given a page with the
|
47
|
+
Given a page with the body:
|
48
48
|
"""
|
49
49
|
<form action="/search">
|
50
50
|
<label for="q">Search term:</label>
|
@@ -52,5 +52,5 @@ Feature: Form Interactions
|
|
52
52
|
<button type="submit">Search</button>
|
53
53
|
</form>
|
54
54
|
"""
|
55
|
-
When I validate the "forms must have submit buttons" standard
|
55
|
+
When I validate the "Form interactions: forms must have submit buttons" standard
|
56
56
|
Then it passes
|
@@ -0,0 +1 @@
|
|
1
|
+
Feature: Tables
|
@@ -6,5 +6,18 @@ Feature: Display failing result
|
|
6
6
|
Then it should fail with:
|
7
7
|
"""
|
8
8
|
✗ http://localhost:54321/missing_header.html
|
9
|
-
|
9
|
+
* Headings: Exactly one main heading
|
10
|
+
- Found 0 h1 elements.
|
11
|
+
"""
|
12
|
+
|
13
|
+
Scenario: Two standards fail
|
14
|
+
Given a website running at http://localhost:54321
|
15
|
+
When I run `a11y http://localhost:54321/two_headings_failures.html`
|
16
|
+
Then it should fail with:
|
17
|
+
"""
|
18
|
+
✗ http://localhost:54321/two_headings_failures.html
|
19
|
+
* Headings: Content must follow headings
|
20
|
+
- No content follows: /html/body/h2
|
21
|
+
* Headings: Exactly one main heading
|
22
|
+
- Found 0 h1 elements.
|
10
23
|
"""
|
@@ -7,7 +7,7 @@ Feature: Display result summary
|
|
7
7
|
page "http://localhost:54321/perfect.html"
|
8
8
|
page "http://localhost:54321/missing_header.html"
|
9
9
|
page "http://localhost:54321/missing_header.html?again!" do
|
10
|
-
skip_standard "exactly one main heading"
|
10
|
+
skip_standard "Headings: exactly one main heading"
|
11
11
|
end
|
12
12
|
"""
|
13
13
|
When I run `a11y`
|
@@ -15,3 +15,17 @@ Feature: Display result summary
|
|
15
15
|
"""
|
16
16
|
3 pages checked, 1 error found, 1 standard skipped
|
17
17
|
"""
|
18
|
+
|
19
|
+
Scenario: Reminds users to consider usability beyond lint results
|
20
|
+
Given a website running at http://localhost:54321
|
21
|
+
When I run `a11y http://localhost:54321/perfect.html`
|
22
|
+
Then it should pass with:
|
23
|
+
"""
|
24
|
+
No errors found. But please remember:
|
25
|
+
|
26
|
+
"Testing shows the presence, not the absence of bugs" -- Edsger W. Dijkstra
|
27
|
+
|
28
|
+
I am only a robot. Always make time to perform manual testing using assistive
|
29
|
+
technologies like VoiceOver, JAWS and NVDA to make sure you're providing a good
|
30
|
+
user experience.
|
31
|
+
"""
|
@@ -12,11 +12,11 @@ Feature: Mute errors
|
|
12
12
|
real examples?
|
13
13
|
|
14
14
|
Scenario: Mute any errors from a specific standard
|
15
|
-
Given a page with the
|
15
|
+
Given a page with the body:
|
16
16
|
"""
|
17
17
|
<p>yo</p>
|
18
18
|
"""
|
19
|
-
When I validate the "exactly one main heading" standard
|
19
|
+
When I validate the "Headings: exactly one main heading" standard
|
20
20
|
Then it fails with the message:
|
21
21
|
"""
|
22
22
|
Found 0 h1 elements.
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'capybara'
|
2
2
|
require 'bbc/a11y/linter'
|
3
|
-
require 'bbc/a11y/standards'
|
4
3
|
require 'bbc/a11y/javascript'
|
5
4
|
|
6
5
|
Given(/^a website running at http:\/\/localhost:(\d+)$/) do |port|
|
@@ -17,21 +16,23 @@ Given(/^one test fails$/) do
|
|
17
16
|
step "I run `a11y http://localhost:54321/missing_header.html`"
|
18
17
|
end
|
19
18
|
|
20
|
-
Given(/^a page with the HTML:$/) do |
|
19
|
+
Given(/^a page with the HTML:$/) do |html|
|
21
20
|
WebServer.ensure_running_on(54321)
|
22
|
-
|
23
|
-
browser.
|
21
|
+
browser.visit 'http://localhost:54321/blank.html'
|
22
|
+
browser.execute_script "document.write(#{html.to_json});"
|
24
23
|
end
|
25
24
|
|
26
|
-
|
27
|
-
WebServer.
|
25
|
+
Given(/^a page with the body:$/) do |body_html|
|
26
|
+
WebServer.ensure_running_on(54321)
|
27
|
+
browser.visit 'http://localhost:54321/blank.html'
|
28
|
+
browser.execute_script "document.body.innerHTML = #{body_html.to_json}"
|
28
29
|
end
|
29
30
|
|
30
31
|
When(/^I validate the \"([^\"]+)\" standard$/) do |standard_name|
|
31
32
|
browser.execute_script(BBC::A11y::Javascript.bundle)
|
32
33
|
validation = browser.evaluate_script("a11y.validate(#{standard_name.to_json})")
|
33
34
|
if validation['results'].size != 1
|
34
|
-
raise "#{validation['results'].size} standards match '#{
|
35
|
+
raise "#{validation['results'].size} standards match '#{standard_name}' (expected 1 match)"
|
35
36
|
end
|
36
37
|
@result = BBC::A11y::LintResult.from_json(validation)
|
37
38
|
end
|
@@ -42,7 +43,7 @@ end
|
|
42
43
|
|
43
44
|
Then(/^it fails with the message:$/) do |message|
|
44
45
|
expect(@result).to be_failed
|
45
|
-
expect(@result.
|
46
|
+
expect(@result.errors.map { |e| e.message}.join("\n")).to eq message
|
46
47
|
end
|
47
48
|
|
48
49
|
Given(/^I am using a TTY terminal$/) do
|
@@ -60,7 +61,7 @@ end
|
|
60
61
|
|
61
62
|
Then(/^I see red in the output$/) do
|
62
63
|
all_output = all_commands.map { |c| c.output }.join("\n")
|
63
|
-
expect(all_output).to include(
|
64
|
+
expect(all_output).to include("\e[31m✗")
|
64
65
|
end
|
65
66
|
|
66
67
|
Then(/^I see monochrome output$/) do
|