bbc-a11y 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CONTRIBUTING.md +2 -2
- data/GETTINGSTARTED.md +16 -7
- data/HISTORY.md +4 -0
- data/features/cli/report_configuration_errors.feature +2 -2
- data/features/cli/skipping_standards.feature +14 -0
- data/lib/bbc/a11y/configuration.rb +8 -8
- data/lib/bbc/a11y/js/bundle.js +2575 -1968
- data/lib/bbc/a11y/js/standards.js +9 -6
- data/lib/bbc/a11y/linter.rb +1 -1
- data/lib/bbc/a11y/version +1 -1
- data/package.json +5 -4
- data/spec/bbc/a11y/configuration_spec.rb +0 -26
- data/spec/bbc/a11y/js/a11ySpec.js +6 -0
- data/spec/bbc/a11y/js/minimumTextSizeStandardSpec.js +8 -0
- data/spec/bbc/a11y/js/standardsSpec.js +2 -2
- metadata +5 -4
@@ -1,8 +1,9 @@
|
|
1
1
|
var xpath = require('./xpath');
|
2
2
|
|
3
|
-
function Standards(standards, skipped) {
|
3
|
+
function Standards(standards, skipped, only) {
|
4
4
|
this.standards = standards;
|
5
5
|
this.skipped = skipped;
|
6
|
+
this.only = only;
|
6
7
|
}
|
7
8
|
|
8
9
|
Standards.sections = {
|
@@ -87,7 +88,7 @@ Standards.matching = function(criteria) {
|
|
87
88
|
return Standards.matching({});
|
88
89
|
}
|
89
90
|
if (typeof(criteria) == 'string') {
|
90
|
-
return Standards.matching({ only: criteria });
|
91
|
+
return Standards.matching({ only: [criteria] });
|
91
92
|
}
|
92
93
|
var matching = standardsMatching(criteria);
|
93
94
|
return new Standards(matching.matches, matching.skipped);
|
@@ -98,15 +99,17 @@ function standardsMatching(criteria) {
|
|
98
99
|
for (var i = 0; i < skips.length; ++i) {
|
99
100
|
skips[i] = normaliseStandardName(skips[i]);
|
100
101
|
}
|
101
|
-
var
|
102
|
-
var
|
102
|
+
var onlies = criteria.only || [];
|
103
|
+
for (var i = 0; i < onlies.length; ++i) {
|
104
|
+
onlies[i] = normaliseStandardName(onlies[i]);
|
105
|
+
}
|
103
106
|
var matches = [];
|
104
107
|
var skipped = [];
|
105
108
|
for (var i = 0; i < Standards.all.length; ++i) {
|
106
109
|
var standard = Standards.all[i];
|
107
110
|
var name = standard.section.toLowerCase() + normaliseStandardName(standard.name);
|
108
|
-
if (
|
109
|
-
if (
|
111
|
+
if (onlies.length > 0) {
|
112
|
+
if (onlies.indexOf(name) > -1) {
|
110
113
|
matches.push(standard);
|
111
114
|
} else {
|
112
115
|
skipped.push(standard.name);
|
data/lib/bbc/a11y/linter.rb
CHANGED
@@ -5,7 +5,7 @@ module BBC
|
|
5
5
|
def lint(page_settings)
|
6
6
|
browser.visit page_settings.url
|
7
7
|
browser.execute_script(BBC::A11y::Javascript.bundle)
|
8
|
-
criteria = { skip: page_settings.skipped_standards }.to_json
|
8
|
+
criteria = { skip: page_settings.skipped_standards, only: page_settings.only_standards }.to_json
|
9
9
|
validation = browser.evaluate_script("a11y.validate(#{criteria})")
|
10
10
|
LintResult.from_json(validation)
|
11
11
|
end
|
data/lib/bbc/a11y/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/package.json
CHANGED
@@ -6,18 +6,19 @@
|
|
6
6
|
"directories": {},
|
7
7
|
"scripts": {
|
8
8
|
"test": "karma start --single-run --browsers PhantomJS",
|
9
|
-
"browserify": "browserify ./lib/bbc/a11y/js/a11y.js -o ./lib/bbc/a11y/js/bundle.js"
|
9
|
+
"browserify": "browserify ./lib/bbc/a11y/js/a11y.js -o ./lib/bbc/a11y/js/bundle.js",
|
10
|
+
"watchify": "watchify ./lib/bbc/a11y/js/a11y.js -o ./lib/bbc/a11y/js/bundle.js"
|
10
11
|
},
|
11
12
|
"repository": {
|
12
13
|
"type": "git",
|
13
|
-
"url": "git+https://github.com/
|
14
|
+
"url": "git+https://github.com/bbc/bbc-a11y.git"
|
14
15
|
},
|
15
16
|
"author": "",
|
16
17
|
"license": "ISC",
|
17
18
|
"bugs": {
|
18
|
-
"url": "https://github.com/
|
19
|
+
"url": "https://github.com/bbc/bbc-a11y/issues"
|
19
20
|
},
|
20
|
-
"homepage": "https://github.com/
|
21
|
+
"homepage": "https://github.com/bbc/bbc-a11y#readme",
|
21
22
|
"devDependencies": {
|
22
23
|
"browser-monkey": "^1.26.3",
|
23
24
|
"browserify": "^12.0.1",
|
@@ -19,31 +19,5 @@ module BBC::A11y
|
|
19
19
|
expect(configuration.pages[1].url).to eq "two.html"
|
20
20
|
end
|
21
21
|
|
22
|
-
it "allows you to specify settings for all pages matching a given URL pattern" do
|
23
|
-
configuration = BBC::A11y.configure do
|
24
|
-
page "three.html" do
|
25
|
-
skip_standard /^Foo/
|
26
|
-
end
|
27
|
-
page "four.html"
|
28
|
-
page "five.html"
|
29
|
-
|
30
|
-
for_pages_matching /^f/ do
|
31
|
-
skip_standard /^Bar/
|
32
|
-
end
|
33
|
-
|
34
|
-
for_pages_matching /^five/ do
|
35
|
-
skip_standard /^Baz/
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
bar = double(name: "BarStandard")
|
40
|
-
baz = double(name: "BazStandard")
|
41
|
-
four_page_settings = configuration.pages[1]
|
42
|
-
expect(four_page_settings.skip_standard?(bar)).to be_truthy
|
43
|
-
five_page_settings = configuration.pages[2]
|
44
|
-
expect(five_page_settings.skip_standard?(bar)).to be_truthy
|
45
|
-
expect(five_page_settings.skip_standard?(baz)).to be_truthy
|
46
|
-
end
|
47
|
-
|
48
22
|
end
|
49
23
|
end
|
@@ -48,4 +48,10 @@ describe('a11y', function() {
|
|
48
48
|
var validation = a11y.validate({ skip: ['Main landmark: Exactly one main landmark'] });
|
49
49
|
expect(validation.skipped).to.eql(['Exactly one main landmark']);
|
50
50
|
});
|
51
|
+
|
52
|
+
it('only runs specific standards', function() {
|
53
|
+
var validation = a11y.validate({ only: ['Main landmark: Exactly one main landmark'] });
|
54
|
+
expect(validation.results.length).to.equal(1)
|
55
|
+
expect(validation.results[0].standard.name).to.equal('Exactly one main landmark')
|
56
|
+
});
|
51
57
|
});
|
@@ -22,4 +22,12 @@ describe('minimum text size standard', function() {
|
|
22
22
|
standard.validate($, fail);
|
23
23
|
expect(failures).to.eql([]);
|
24
24
|
});
|
25
|
+
|
26
|
+
it('only reports the parent element when a child element also has small fonts', function() {
|
27
|
+
$('<div style="font-size: 1px"><span style="font-size: 2px">Text!</span></div>').appendTo('body');
|
28
|
+
var failures = [];
|
29
|
+
var fail = function(failure) { failures.push(failure); }
|
30
|
+
standard.validate($, fail);
|
31
|
+
expect(failures).to.eql(['Text size too small (2px):']);
|
32
|
+
});
|
25
33
|
});
|
@@ -23,9 +23,9 @@ describe('standards', function() {
|
|
23
23
|
});
|
24
24
|
});
|
25
25
|
|
26
|
-
describe('.matching({ only: "Focusable controls: Anchors must have hrefs" })', function() {
|
26
|
+
describe('.matching({ only: ["Focusable controls: Anchors must have hrefs"] })', function() {
|
27
27
|
it('finds one standard', function() {
|
28
|
-
var matches = standards.matching({ only: "Focusable controls: Anchors must have hrefs" });
|
28
|
+
var matches = standards.matching({ only: ["Focusable controls: Anchors must have hrefs"] });
|
29
29
|
expect(matches.standards.length).to.equal(1);
|
30
30
|
});
|
31
31
|
});
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bbc-a11y
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Wynne
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-12-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: capybara
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- CONTRIBUTING.md
|
141
141
|
- GETTINGSTARTED.md
|
142
142
|
- Gemfile
|
143
|
+
- HISTORY.md
|
143
144
|
- LICENSE
|
144
145
|
- README.md
|
145
146
|
- Rakefile
|
@@ -241,10 +242,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
242
|
version: '0'
|
242
243
|
requirements: []
|
243
244
|
rubyforge_project:
|
244
|
-
rubygems_version: 2.
|
245
|
+
rubygems_version: 2.5.2
|
245
246
|
signing_key:
|
246
247
|
specification_version: 4
|
247
|
-
summary: bbc-a11y-0.3.
|
248
|
+
summary: bbc-a11y-0.3.1
|
248
249
|
test_files:
|
249
250
|
- features/README.md
|
250
251
|
- features/check_standards/01_core_purpose.feature
|