govuk_publishing_components 1.7.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d524eeb4db7af24131c3a967c345480f17bae8f8
|
4
|
+
data.tar.gz: ea47e54e89299120ba9937a4eca6b755ee62cd01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bc0d5d9614e4d71c2713476c2f45b836726a53937bb980c4e331c0deb87b44f68afb6eb065e71163900e2a7bc25cbc4630326c22e9adc56c72e3b362d9b9095
|
7
|
+
data.tar.gz: fe56d2ec25a0eea3e897c84cae9509fc99a6467e3559c34c64bb21ee87cfbd944f3eec86f3a288b56a374bc132a906c8ca8efb15fa3a14d7cb225f3af2d8f8f0
|
data/README.md
CHANGED
@@ -27,6 +27,23 @@ https://government-frontend.herokuapp.com/component-guide
|
|
27
27
|
|
28
28
|
The guide includes your application’s `application.scss` and `application.js` files by default. This is [configurable](#configuration).
|
29
29
|
|
30
|
+
## Test the component guide
|
31
|
+
|
32
|
+
The gem [includes integration tests](lib/govuk_publishing_components/minitest/component_guide_test.rb) to check that your component guide and examples are error free and that they meet basic accessibility needs.
|
33
|
+
|
34
|
+
Automated accessibility tests use [aXe](https://github.com/dequelabs/axe-core). Using our `AccessibilityTest` wrapper the gem runs the aXe suite against each example and throws JavaScript errors for any violations. These JavaScript errors can be used to fail a build in CI.
|
35
|
+
|
36
|
+
### Minitest
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
# component_guide_test.rb
|
40
|
+
require 'govuk_publishing_components/minitest/component_guide_test'
|
41
|
+
|
42
|
+
class ComponentGuideTest < ActionDispatch::IntegrationTest
|
43
|
+
include GovukPublishingComponents::Minitest::ComponentGuideTest
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
30
47
|
### Install gem
|
31
48
|
|
32
49
|
Add this line to your application's Gemfile in the [development and test groups](http://bundler.io/v1.12/groups.html#grouping-your-dependencies):
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module GovukPublishingComponents
|
2
|
+
module Minitest
|
3
|
+
module ComponentGuideTest
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
included do
|
7
|
+
test "renders all component guide preview pages without erroring" do
|
8
|
+
visit '/component-guide'
|
9
|
+
|
10
|
+
# Confirm accessibility JS test is available
|
11
|
+
assert_equal 'function', evaluate_script('typeof window.GOVUK.AccessibilityTest'), "AccessibilityTest JavaScript isn’t available"
|
12
|
+
assert_equal 'string', evaluate_script('typeof window.axe.version'), "aXe accessibility test library isn’t available"
|
13
|
+
|
14
|
+
all(:css, '.component-list a').map { |el| "#{el[:href]}/preview" }.each do |component|
|
15
|
+
visit component
|
16
|
+
assert page.has_css?(".js-test-a11y-finished"), "Accessibility test did not run on #{component}"
|
17
|
+
assert page.has_css?(".js-test-a11y-success"), "Accessibility test found violations on #{component}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: govuk_publishing_components
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GOV.UK Dev
|
@@ -205,6 +205,7 @@ files:
|
|
205
205
|
- lib/govuk_publishing_components.rb
|
206
206
|
- lib/govuk_publishing_components/config.rb
|
207
207
|
- lib/govuk_publishing_components/engine.rb
|
208
|
+
- lib/govuk_publishing_components/minitest/component_guide_test.rb
|
208
209
|
- lib/govuk_publishing_components/version.rb
|
209
210
|
- lib/tasks/govuk_publishing_components_tasks.rake
|
210
211
|
homepage: https://github.com/alphagov/govuk_publishing_components
|