ra11y 0.0.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.
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ra11y/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ra11y"
8
+ spec.version = Ra11y::VERSION
9
+ spec.authors = ["Ben Balter"]
10
+ spec.email = ["ben.balter@github.com"]
11
+ spec.summary = "Ruby-based accessibility testing for Jekyll and other static sites"
12
+ spec.homepage = "https://github.com/benbalter/ra11y"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_dependency "colorator"
21
+ spec.add_dependency "parallel"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.6"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "pry"
27
+ end
@@ -0,0 +1 @@
1
+ bundle install
@@ -0,0 +1,6 @@
1
+ #!/bin/sh
2
+
3
+ set -e
4
+
5
+ bundle exec rake spec
6
+ bundle exec gem build ra11y.gemspec
@@ -0,0 +1 @@
1
+ bundle exec pry -r "./lib/ra11y.rb"
@@ -0,0 +1,38 @@
1
+ #!/bin/sh
2
+ # Tag and push a release.
3
+
4
+ set -e
5
+
6
+ # Make sure we're in the project root.
7
+
8
+ cd $(dirname "$0")/..
9
+
10
+ # Build a new gem archive.
11
+
12
+ rm -rf ra11y-*.gem
13
+ gem build -q ra11y.gemspec
14
+
15
+ # Make sure we're on the master branch.
16
+
17
+ (git branch | grep -q '* master') || {
18
+ echo "Only release from the master branch."
19
+ exit 1
20
+ }
21
+
22
+ # Figure out what version we're releasing.
23
+
24
+ tag=v`ls ra11y-*.gem | sed 's/^ra11y-\(.*\)\.gem$/\1/'`
25
+
26
+ # Make sure we haven't released this version before.
27
+
28
+ git fetch -t origin
29
+
30
+ (git tag -l | grep -q "$tag") && {
31
+ echo "Whoops, there's already a '${tag}' tag."
32
+ exit 1
33
+ }
34
+
35
+ # Tag it and bag it.
36
+
37
+ gem push ra11y-*.gem && git tag "$tag" &&
38
+ git push origin master && git push origin "$tag"
@@ -0,0 +1 @@
1
+ curl http://squizlabs.github.io/HTML_CodeSniffer/build/HTMLCS.js -o lib/vendor/htmlcs.js
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>1.3.1 Labels</title>
5
+ </head>
6
+ <body>
7
+ <form>
8
+ <!-- Basic Stuff with no label -->
9
+ <input type="text" id="noLabelText" />
10
+ <input id="noLabelDefault" />
11
+ </form>
12
+ </body>
13
+ </html>
File without changes
@@ -0,0 +1,10 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>1.1.1 Null Alt Text on Images and Areas</title>
5
+ </head>
6
+ <body>
7
+ <img id="hasNoAltText" />
8
+ <img id="hasEmptyAltText" alt="" />
9
+ </body>
10
+ </html>
@@ -0,0 +1,27 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1">
7
+ <title>Hello, world!</title>
8
+
9
+ <!-- Bootstrap -->
10
+ <link href="css/bootstrap.min.css" rel="stylesheet">
11
+
12
+ <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
13
+ <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
14
+ <!--[if lt IE 9]>
15
+ <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
16
+ <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
17
+ <![endif]-->
18
+ </head>
19
+ <body>
20
+ <h1>Hello, world!</h1>
21
+
22
+ <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
23
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
24
+ <!-- Include all compiled plugins (below), or include individual files as needed -->
25
+ <script src="js/bootstrap.min.js"></script>
26
+ </body>
27
+ </html>
@@ -0,0 +1,38 @@
1
+ require "spec_helper"
2
+
3
+ describe "Ra11y::HtmlFile" do
4
+
5
+ before do
6
+ @file = Ra11y::HtmlFile.new File.expand_path("index.html", fixtures_path)
7
+ @perfect = Ra11y::HtmlFile.new File.expand_path("perfect.html", fixtures_path)
8
+ end
9
+
10
+ it "should store the path" do
11
+ expect(@file.path).to eql(File.expand_path("index.html", fixtures_path))
12
+ end
13
+
14
+ it "should know when a file is perfect" do
15
+ expect(@perfect.perfect?).to eql(true)
16
+ end
17
+
18
+ it "should know when a file isn't perfect" do
19
+ expect(@file.perfect?).to eql(false)
20
+ end
21
+
22
+ it "returns the results" do
23
+ expect(@file.results.first.class).to eql(Ra11y::Result)
24
+ expect(@file.results.count).to eql(6)
25
+ end
26
+
27
+ it "returns the errors" do
28
+ expect(@file.errors.count).to eql(2)
29
+ end
30
+
31
+ it "returns the warnings" do
32
+ expect(@file.warnings.count).to eql(1)
33
+ end
34
+
35
+ it "returns the notices" do
36
+ expect(@file.notices.count).to eql(3)
37
+ end
38
+ end
@@ -0,0 +1,35 @@
1
+ require "spec_helper"
2
+
3
+ describe "Ra11y::Result" do
4
+
5
+ before do
6
+ @result = Ra11y::Result.new({ "code" => "foo", "message" => "bar", "type" => "error" })
7
+ end
8
+
9
+ it "stores the hash" do
10
+ expect(@result.code).to eql("foo")
11
+ expect(@result.message).to eql("bar")
12
+ expect(@result.type).to eql("error")
13
+ end
14
+
15
+ it "knows when its an error" do
16
+ expect(@result.error?).to eql(true)
17
+ expect(@result.warning?).to eql(false)
18
+ expect(@result.notice?).to eql(false)
19
+
20
+ end
21
+
22
+ it "knows when its a notice" do
23
+ result = Ra11y::Result.new({ "code" => "foo", "message" => "bar", "type" => "notice" })
24
+ expect(result.error?).to eql(false)
25
+ expect(result.warning?).to eql(false)
26
+ expect(result.notice?).to eql(true)
27
+ end
28
+
29
+ it "knows when its a warning" do
30
+ result = Ra11y::Result.new({ "code" => "foo", "message" => "bar", "type" => "warning" })
31
+ expect(result.error?).to eql(false)
32
+ expect(result.warning?).to eql(true)
33
+ expect(result.notice?).to eql(false)
34
+ end
35
+ end
@@ -0,0 +1,23 @@
1
+ require "spec_helper"
2
+
3
+ describe "Ra11y::Site" do
4
+
5
+ before do
6
+ @site = Ra11y::Site.new(fixtures_path)
7
+ end
8
+
9
+ it "stores the path" do
10
+ expect(@site.path).to eql(fixtures_path)
11
+ end
12
+
13
+ it "knows the path to html files" do
14
+ expect(@site.paths.count).to eql(3)
15
+ expected = File.expand_path "about.html", fixtures_path
16
+ expect(@site.paths.first).to eql(expected)
17
+ end
18
+
19
+ it "builds the HTML files" do
20
+ expect(@site.html_files.count).to eql(3)
21
+ expect(@site.html_files.first.class).to eql(Ra11y::HtmlFile)
22
+ end
23
+ end
@@ -0,0 +1,30 @@
1
+ require "spec_helper"
2
+
3
+ describe "Ra11y" do
4
+
5
+ before(:each) do
6
+ Ra11y.options = {}
7
+ end
8
+
9
+ it "returns the executable version" do
10
+ expect(Ra11y.executable_version).to match(/\d\.\d\.\d/)
11
+ end
12
+
13
+ it "runs a command" do
14
+ expect(Ra11y.run_command("--help")).to match(/Usage/)
15
+ end
16
+
17
+ it "defaults to the default options" do
18
+ expect(Ra11y.options[:executable]).to eql("pa11y")
19
+ end
20
+
21
+ it "allows users to set options" do
22
+ Ra11y.options = { :foo => "bar" }
23
+ expect(Ra11y.options[:foo]).to eql("bar")
24
+ end
25
+
26
+ it "allows users to override the defaults" do
27
+ Ra11y.options = { :executable => "foo" }
28
+ expect(Ra11y.options[:executable]).to eql("foo")
29
+ end
30
+ end
@@ -0,0 +1,10 @@
1
+ require "bundler/setup"
2
+
3
+ ENV['RACK_ENV'] = 'test'
4
+ $:.push File.join(File.dirname(__FILE__), '..', 'lib')
5
+
6
+ require 'ra11y'
7
+
8
+ def fixtures_path
9
+ File.expand_path "./fixtures", File.dirname(__FILE__)
10
+ end
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ra11y
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ben Balter
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-03-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: colorator
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: parallel
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description:
98
+ email:
99
+ - ben.balter@github.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - ".travis.yml"
106
+ - Gemfile
107
+ - LICENSE.txt
108
+ - README.md
109
+ - Rakefile
110
+ - lib/ra11y.rb
111
+ - lib/ra11y/html_file.rb
112
+ - lib/ra11y/result.rb
113
+ - lib/ra11y/site.rb
114
+ - lib/ra11y/version.rb
115
+ - lib/vendor/htmlcs.js
116
+ - ra11y.gemspec
117
+ - script/bootstrap
118
+ - script/cibuild
119
+ - script/console
120
+ - script/release
121
+ - script/vendor
122
+ - spec/fixtures/about.html
123
+ - spec/fixtures/foo.md
124
+ - spec/fixtures/index.html
125
+ - spec/fixtures/perfect.html
126
+ - spec/ra11y_html_file_spec.rb
127
+ - spec/ra11y_result_spec.rb
128
+ - spec/ra11y_site_spec.rb
129
+ - spec/ra11y_spec.rb
130
+ - spec/spec_helper.rb
131
+ homepage: https://github.com/benbalter/ra11y
132
+ licenses:
133
+ - MIT
134
+ metadata: {}
135
+ post_install_message:
136
+ rdoc_options: []
137
+ require_paths:
138
+ - lib
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - ">="
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ required_rubygems_version: !ruby/object:Gem::Requirement
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ requirements: []
150
+ rubyforge_project:
151
+ rubygems_version: 2.2.0
152
+ signing_key:
153
+ specification_version: 4
154
+ summary: Ruby-based accessibility testing for Jekyll and other static sites
155
+ test_files:
156
+ - spec/fixtures/about.html
157
+ - spec/fixtures/foo.md
158
+ - spec/fixtures/index.html
159
+ - spec/fixtures/perfect.html
160
+ - spec/ra11y_html_file_spec.rb
161
+ - spec/ra11y_result_spec.rb
162
+ - spec/ra11y_site_spec.rb
163
+ - spec/ra11y_spec.rb
164
+ - spec/spec_helper.rb