bbc-a11y 0.0.7 → 0.0.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c500e30582170fa192229eecaf43deaa0433188
4
- data.tar.gz: b241d785a67dd287ee88237bcd7e8dd51693f86f
3
+ metadata.gz: 0c6b1965b456e7b2dfc8d99de5462ea914992a87
4
+ data.tar.gz: 01e2e192cfef634ac65ab484b302988d9fb40815
5
5
  SHA512:
6
- metadata.gz: 2f408fbb3a4eee36ed69a9b63876738355c78504df3165da084e708597c4af3cb975df980a9dd7d8a8cb00a2dafeb8cd27aa92c614b4b04b4ac96526bb6087f6
7
- data.tar.gz: c8aaec1516aa562b8dd35509ed92cc499e720fe72ab49c6641b7add0e35ea4e19f1dc22b21f0dd437fe6f095434ef385670934fd9a1bba426978398eee1f88e3
6
+ metadata.gz: 572d1b947bca6f1262fd1e30bebdf41f39b69d9f8223580d66a637c58434050fe0965991bfc5f8000429eda8ca16c534fa43fdb86ad7ad0b6fb6592a73336e70
7
+ data.tar.gz: be1b5c5c7226d24b497958dcfe642757a2ddf6c754ef18fc9ae55390c3286c02bdce20f5086766832a970f1ef5186b5e893bc28526c71982728ec5128a9a2088
@@ -58,8 +58,11 @@ module BBC
58
58
  end
59
59
 
60
60
  def must_not_have_any_positive_tabindex_values
61
- bad_nodes = browser.all('[tabindex]').select { |node| node['tabindex'].to_i >= 0 }
62
- expect(bad_nodes).to be_empty
61
+ nodes_with_positive_tabindex = browser.all('[tabindex]').select { |node| node['tabindex'].to_i > 0 }
62
+ expect(nodes_with_positive_tabindex).to be_empty
63
+ nodes_with_zero_tabindex = browser.all('[tabindex]').select { |node| node['tabindex'].to_i == 0 }
64
+ bad_nodes_with_zero_tabindex = nodes_with_zero_tabindex.reject { |node| node.tag_name =~ /^a|button|input|select|textarea$/ }
65
+ expect(bad_nodes_with_zero_tabindex).to be_empty
63
66
  end
64
67
 
65
68
  def to_s
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
@@ -116,6 +116,49 @@ module BBC::A11y::CucumberSupport
116
116
  to raise_error(RSpec::Expectations::ExpectationNotMetError)
117
117
  end
118
118
  end
119
+
120
+ context "a zero tabindex value on a focusable element (<a>, <button>, <input>, <select>, <textarea>)" do
121
+ let(:html) { <<-HTML }
122
+ <html>
123
+ <body>
124
+ <a tabindex="0">Important</a>
125
+ </body>
126
+ </html>
127
+ HTML
128
+
129
+ it "passes" do
130
+ expect { page.must_not_have_any_positive_tabindex_values }.not_to raise_error
131
+ end
132
+ end
133
+
134
+ context "a zero tabindex value on a non-focusable element" do
135
+ let(:html) { <<-HTML }
136
+ <html>
137
+ <body>
138
+ <p tabindex="0">Important</a>
139
+ </body>
140
+ </html>
141
+ HTML
142
+
143
+ it "fails" do
144
+ expect { page.must_not_have_any_positive_tabindex_values }.
145
+ to raise_error(RSpec::Expectations::ExpectationNotMetError)
146
+ end
147
+ end
148
+
149
+ context "a negative tabindex value" do
150
+ let(:html) { <<-HTML }
151
+ <html>
152
+ <body>
153
+ <p tabindex="-1">Important</a>
154
+ </body>
155
+ </html>
156
+ HTML
157
+
158
+ it "passes" do
159
+ expect { page.must_not_have_any_positive_tabindex_values }.not_to raise_error
160
+ end
161
+ end
119
162
  end
120
163
 
121
164
  describe '#to_s' do
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.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wynne
@@ -244,7 +244,7 @@ rubyforge_project:
244
244
  rubygems_version: 2.0.14
245
245
  signing_key:
246
246
  specification_version: 4
247
- summary: bbc-a11y-0.0.7
247
+ summary: bbc-a11y-0.0.8
248
248
  test_files:
249
249
  - features/01_core-purpose.md
250
250
  - features/02_validation.feature