ccs-frontend_helpers 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -3
  3. data/CHANGELOG.md +35 -0
  4. data/Gemfile +7 -6
  5. data/Gemfile.lock +126 -122
  6. data/README.md +11 -0
  7. data/lib/ccs/components/govuk/accordion/section/content.rb +1 -1
  8. data/lib/ccs/components/govuk/accordion.rb +11 -0
  9. data/lib/ccs/components/govuk/button.rb +4 -1
  10. data/lib/ccs/components/govuk/cookie_banner/action.rb +1 -0
  11. data/lib/ccs/components/govuk/cookie_banner/message.rb +1 -1
  12. data/lib/ccs/components/govuk/details.rb +1 -1
  13. data/lib/ccs/components/govuk/error_message.rb +5 -2
  14. data/lib/ccs/components/govuk/exit_this_page.rb +79 -0
  15. data/lib/ccs/components/govuk/field/input/character_count.rb +60 -17
  16. data/lib/ccs/components/govuk/field/input/select.rb +2 -2
  17. data/lib/ccs/components/govuk/field/inputs/checkboxes.rb +7 -6
  18. data/lib/ccs/components/govuk/field/inputs/date_input.rb +3 -3
  19. data/lib/ccs/components/govuk/field/inputs/item/checkbox.rb +1 -13
  20. data/lib/ccs/components/govuk/field/inputs/item/radio.rb +1 -13
  21. data/lib/ccs/components/govuk/field/inputs/item.rb +24 -10
  22. data/lib/ccs/components/govuk/field/inputs/radios.rb +3 -4
  23. data/lib/ccs/components/govuk/field/inputs.rb +24 -6
  24. data/lib/ccs/components/govuk/fieldset.rb +1 -1
  25. data/lib/ccs/components/govuk/footer/meta.rb +1 -1
  26. data/lib/ccs/components/govuk/footer.rb +1 -1
  27. data/lib/ccs/components/govuk/header/navigation.rb +4 -2
  28. data/lib/ccs/components/govuk/header.rb +26 -7
  29. data/lib/ccs/components/govuk/pagination/increment/next.rb +6 -3
  30. data/lib/ccs/components/govuk/pagination/increment/previous.rb +6 -3
  31. data/lib/ccs/components/govuk/pagination/increment.rb +11 -3
  32. data/lib/ccs/components/govuk/pagination/item.rb +1 -1
  33. data/lib/ccs/components/govuk/pagination.rb +2 -2
  34. data/lib/ccs/components/govuk/summary_list/action/link.rb +18 -3
  35. data/lib/ccs/components/govuk/summary_list/card/actions.rb +3 -2
  36. data/lib/ccs/components/govuk/summary_list/card.rb +1 -1
  37. data/lib/ccs/components/govuk/summary_list/row/actions.rb +3 -2
  38. data/lib/ccs/components/govuk/summary_list/row.rb +7 -2
  39. data/lib/ccs/components/govuk/summary_list.rb +1 -1
  40. data/lib/ccs/components/govuk/tabs.rb +5 -3
  41. data/lib/ccs/components/govuk/task_list/item/status.rb +64 -0
  42. data/lib/ccs/components/govuk/task_list/item/title.rb +54 -0
  43. data/lib/ccs/components/govuk/task_list/item.rb +75 -0
  44. data/lib/ccs/components/govuk/task_list.rb +52 -0
  45. data/lib/ccs/components/govuk/warning_text.rb +1 -1
  46. data/lib/ccs/frontend_helpers/govuk_frontend/character_count.rb +1 -1
  47. data/lib/ccs/frontend_helpers/govuk_frontend/error_message.rb +1 -1
  48. data/lib/ccs/frontend_helpers/govuk_frontend/exit_this_page.rb +28 -0
  49. data/lib/ccs/frontend_helpers/govuk_frontend/task_list.rb +28 -0
  50. data/lib/ccs/frontend_helpers/govuk_frontend.rb +4 -0
  51. data/lib/ccs/frontend_helpers/version.rb +1 -1
  52. data/package.json +10 -0
  53. data/yarn.lock +8 -0
  54. metadata +11 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0ef86c828ca8a268f9af33212c8ada74ff7ba0d0b01af5fc36200ec5ad98fde1
4
- data.tar.gz: 2259677fea66d59061a029ee951b4f2246a2e96adbd9d153f188054d34d213ad
3
+ metadata.gz: 294fb84084e25efd871cf66bf4513023648669964b1fbc026aece725bcd64c78
4
+ data.tar.gz: cd55ae750739c51a9561871d5d2c782a067ace1b04f7014e3b41d05349db6f68
5
5
  SHA512:
6
- metadata.gz: a451c37ef27586b33004da34c9a2d709e5cc97c8af0b477a509f16175788b0de2b2368ea13c4b3a88e2221a6fc9ebf3a6c42157bb10c5acfef662d45de473db9
7
- data.tar.gz: c8bf663b057106329a327c7a7d1f0219edc982f801fd34b46904de3223f3aa2c337c024569139b6dd3bf79afa62ec407a571ab9b93e010c86eb70d795207c608
6
+ metadata.gz: d64eb288f9595343e58ec37eec080a925928b908273c1880efd409a3cde6f9015567221838496084c03d3799dd54ea7ae10328e4c545d446d0f876b0892efb9c
7
+ data.tar.gz: d1c288ab82c3c78b1049a1bf8d580b515d213d52758aedf378799262efa854880eab99e69251e0cf74502bb29af8da7fa965adf6275f8755672896dc49787a43
data/.rubocop.yml CHANGED
@@ -126,11 +126,13 @@ RSpec/MultipleExpectations:
126
126
  Max: 3
127
127
 
128
128
  RSpec/FilePath:
129
- CustomTransform:
130
- GovUKFrontend: govuk_frontend
131
- GovUK: govuk
129
+ Enabled: false
132
130
 
133
131
  RSpec/SpecFilePathFormat:
134
132
  CustomTransform:
135
133
  GovUKFrontend: govuk_frontend
136
134
  GovUK: govuk
135
+
136
+ Rails/OutputSafety:
137
+ Exclude:
138
+ - 'spec/ccs/frontend_helpers/**/*fixtures_spec.rb'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,38 @@
1
+ ## [0.2.0] - 2024-03-13
2
+
3
+ ### 💥 Breaking changes
4
+
5
+ Update components to be compatible with GOV.UK Frontend v5.2
6
+
7
+ For pagination, the option to enable ellipsis is now:
8
+ ```ruby
9
+ {
10
+ ellipsis: true
11
+ }
12
+ ```
13
+ instead of:
14
+ ```ruby
15
+ {
16
+ type: :ellipsis
17
+ }
18
+ ```
19
+
20
+ ### 🏠 Internal changes
21
+
22
+ Add tests for GOV.UK Frontend fixtures
23
+
24
+ ### 🆕 New features
25
+
26
+ The following GOV.UK helpers have been added:
27
+
28
+ - Exit this page
29
+ - Task list
30
+
31
+ ## [0.1.2] - 2023-11-16
32
+
33
+ Fix issue with radios component which, when passed a model or form, would treat the value as an array.
34
+ This did not cause an issue for strings as the `include?` method still works for them but if the value was a boolean or a number then an error would be thrown.
35
+
1
36
  ## [0.1.1] - 2023-10-25
2
37
 
3
38
  Fix some bugs with various helpers and update dependencies
data/Gemfile CHANGED
@@ -7,18 +7,19 @@ gemspec
7
7
 
8
8
  # Gems for building the package
9
9
  gem 'bundler', '~> 2.3'
10
- gem 'rake', '~> 13.0'
10
+ gem 'rake', '~> 13.1'
11
11
 
12
12
  # Gems for testing the package
13
- gem 'capybara', '~> 3.39.2'
14
- gem 'rspec', '~> 3.12'
13
+ gem 'capybara', '~> 3.40.0'
14
+ gem 'rspec', '~> 3.13'
15
15
  gem 'simplecov', '~> 0.21'
16
+ gem 'nokogiri-diff', '~> 0.3.0'
16
17
 
17
18
  # Gems for linting/formatting the package
18
- gem 'rubocop', '~> 1.57'
19
- gem 'rubocop-rails', '~> 2.21'
19
+ gem 'rubocop', '~> 1.62'
20
+ gem 'rubocop-rails', '~> 2.24'
20
21
  gem 'rubocop-rake', '~> 0.6'
21
- gem 'rubocop-rspec', '~> 2.24'
22
+ gem 'rubocop-rspec', '~> 2.27'
22
23
 
23
24
  # Gems for documenting the package
24
25
  gem 'yard', '~> 0.9'
data/Gemfile.lock CHANGED
@@ -1,76 +1,77 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ccs-frontend_helpers (0.1.1)
4
+ ccs-frontend_helpers (0.2.0)
5
5
  rails (>= 6.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.1.1)
11
- actionpack (= 7.1.1)
12
- activesupport (= 7.1.1)
10
+ actioncable (7.1.3.2)
11
+ actionpack (= 7.1.3.2)
12
+ activesupport (= 7.1.3.2)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
15
  zeitwerk (~> 2.6)
16
- actionmailbox (7.1.1)
17
- actionpack (= 7.1.1)
18
- activejob (= 7.1.1)
19
- activerecord (= 7.1.1)
20
- activestorage (= 7.1.1)
21
- activesupport (= 7.1.1)
16
+ actionmailbox (7.1.3.2)
17
+ actionpack (= 7.1.3.2)
18
+ activejob (= 7.1.3.2)
19
+ activerecord (= 7.1.3.2)
20
+ activestorage (= 7.1.3.2)
21
+ activesupport (= 7.1.3.2)
22
22
  mail (>= 2.7.1)
23
23
  net-imap
24
24
  net-pop
25
25
  net-smtp
26
- actionmailer (7.1.1)
27
- actionpack (= 7.1.1)
28
- actionview (= 7.1.1)
29
- activejob (= 7.1.1)
30
- activesupport (= 7.1.1)
26
+ actionmailer (7.1.3.2)
27
+ actionpack (= 7.1.3.2)
28
+ actionview (= 7.1.3.2)
29
+ activejob (= 7.1.3.2)
30
+ activesupport (= 7.1.3.2)
31
31
  mail (~> 2.5, >= 2.5.4)
32
32
  net-imap
33
33
  net-pop
34
34
  net-smtp
35
35
  rails-dom-testing (~> 2.2)
36
- actionpack (7.1.1)
37
- actionview (= 7.1.1)
38
- activesupport (= 7.1.1)
36
+ actionpack (7.1.3.2)
37
+ actionview (= 7.1.3.2)
38
+ activesupport (= 7.1.3.2)
39
39
  nokogiri (>= 1.8.5)
40
+ racc
40
41
  rack (>= 2.2.4)
41
42
  rack-session (>= 1.0.1)
42
43
  rack-test (>= 0.6.3)
43
44
  rails-dom-testing (~> 2.2)
44
45
  rails-html-sanitizer (~> 1.6)
45
- actiontext (7.1.1)
46
- actionpack (= 7.1.1)
47
- activerecord (= 7.1.1)
48
- activestorage (= 7.1.1)
49
- activesupport (= 7.1.1)
46
+ actiontext (7.1.3.2)
47
+ actionpack (= 7.1.3.2)
48
+ activerecord (= 7.1.3.2)
49
+ activestorage (= 7.1.3.2)
50
+ activesupport (= 7.1.3.2)
50
51
  globalid (>= 0.6.0)
51
52
  nokogiri (>= 1.8.5)
52
- actionview (7.1.1)
53
- activesupport (= 7.1.1)
53
+ actionview (7.1.3.2)
54
+ activesupport (= 7.1.3.2)
54
55
  builder (~> 3.1)
55
56
  erubi (~> 1.11)
56
57
  rails-dom-testing (~> 2.2)
57
58
  rails-html-sanitizer (~> 1.6)
58
- activejob (7.1.1)
59
- activesupport (= 7.1.1)
59
+ activejob (7.1.3.2)
60
+ activesupport (= 7.1.3.2)
60
61
  globalid (>= 0.3.6)
61
- activemodel (7.1.1)
62
- activesupport (= 7.1.1)
63
- activerecord (7.1.1)
64
- activemodel (= 7.1.1)
65
- activesupport (= 7.1.1)
62
+ activemodel (7.1.3.2)
63
+ activesupport (= 7.1.3.2)
64
+ activerecord (7.1.3.2)
65
+ activemodel (= 7.1.3.2)
66
+ activesupport (= 7.1.3.2)
66
67
  timeout (>= 0.4.0)
67
- activestorage (7.1.1)
68
- actionpack (= 7.1.1)
69
- activejob (= 7.1.1)
70
- activerecord (= 7.1.1)
71
- activesupport (= 7.1.1)
68
+ activestorage (7.1.3.2)
69
+ actionpack (= 7.1.3.2)
70
+ activejob (= 7.1.3.2)
71
+ activerecord (= 7.1.3.2)
72
+ activesupport (= 7.1.3.2)
72
73
  marcel (~> 1.0)
73
- activesupport (7.1.1)
74
+ activesupport (7.1.3.2)
74
75
  base64
75
76
  bigdecimal
76
77
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -80,41 +81,40 @@ GEM
80
81
  minitest (>= 5.1)
81
82
  mutex_m
82
83
  tzinfo (~> 2.0)
83
- addressable (2.8.4)
84
+ addressable (2.8.6)
84
85
  public_suffix (>= 2.0.2, < 6.0)
85
86
  ast (2.4.2)
86
- base64 (0.1.1)
87
- bigdecimal (3.1.4)
87
+ base64 (0.2.0)
88
+ bigdecimal (3.1.6)
88
89
  builder (3.2.4)
89
- capybara (3.39.2)
90
+ capybara (3.40.0)
90
91
  addressable
91
92
  matrix
92
93
  mini_mime (>= 0.1.3)
93
- nokogiri (~> 1.8)
94
+ nokogiri (~> 1.11)
94
95
  rack (>= 1.6.0)
95
96
  rack-test (>= 0.6.3)
96
97
  regexp_parser (>= 1.5, < 3.0)
97
98
  xpath (~> 3.2)
98
- concurrent-ruby (1.2.2)
99
+ concurrent-ruby (1.2.3)
99
100
  connection_pool (2.4.1)
100
101
  crass (1.0.6)
101
- date (3.3.3)
102
- diff-lcs (1.5.0)
102
+ date (3.3.4)
103
+ diff-lcs (1.5.1)
103
104
  docile (1.4.0)
104
- drb (2.1.1)
105
- ruby2_keywords
105
+ drb (2.2.1)
106
106
  erubi (1.12.0)
107
107
  globalid (1.2.1)
108
108
  activesupport (>= 6.1)
109
- i18n (1.14.1)
109
+ i18n (1.14.4)
110
110
  concurrent-ruby (~> 1.0)
111
- io-console (0.6.0)
112
- irb (1.8.3)
111
+ io-console (0.7.2)
112
+ irb (1.11.2)
113
113
  rdoc
114
- reline (>= 0.3.8)
115
- json (2.6.3)
114
+ reline (>= 0.4.2)
115
+ json (2.7.1)
116
116
  language_server-protocol (3.17.0.3)
117
- loofah (2.21.4)
117
+ loofah (2.22.0)
118
118
  crass (~> 1.0.2)
119
119
  nokogiri (>= 1.12.0)
120
120
  mail (2.8.1)
@@ -125,31 +125,34 @@ GEM
125
125
  marcel (1.0.2)
126
126
  matrix (0.4.2)
127
127
  mini_mime (1.1.5)
128
- minitest (5.20.0)
129
- mutex_m (0.1.2)
130
- net-imap (0.4.2)
128
+ minitest (5.22.2)
129
+ mutex_m (0.2.0)
130
+ net-imap (0.4.10)
131
131
  date
132
132
  net-protocol
133
133
  net-pop (0.1.2)
134
134
  net-protocol
135
- net-protocol (0.2.1)
135
+ net-protocol (0.2.2)
136
136
  timeout
137
- net-smtp (0.4.0)
137
+ net-smtp (0.4.0.1)
138
138
  net-protocol
139
- nio4r (2.5.9)
140
- nokogiri (1.15.4-x86_64-darwin)
139
+ nio4r (2.7.0)
140
+ nokogiri (1.16.2-x86_64-darwin)
141
141
  racc (~> 1.4)
142
- nokogiri (1.15.4-x86_64-linux)
142
+ nokogiri (1.16.2-x86_64-linux)
143
143
  racc (~> 1.4)
144
- parallel (1.23.0)
145
- parser (3.2.2.4)
144
+ nokogiri-diff (0.3.0)
145
+ nokogiri (~> 1.5)
146
+ tdiff (~> 0.4)
147
+ parallel (1.24.0)
148
+ parser (3.3.0.5)
146
149
  ast (~> 2.4.1)
147
150
  racc
148
- psych (5.1.1.1)
151
+ psych (5.1.2)
149
152
  stringio
150
- public_suffix (5.0.1)
151
- racc (1.7.1)
152
- rack (3.0.8)
153
+ public_suffix (5.0.4)
154
+ racc (1.7.3)
155
+ rack (3.0.9.1)
153
156
  rack-session (2.0.0)
154
157
  rack (>= 3.0.0)
155
158
  rack-test (2.1.0)
@@ -157,20 +160,20 @@ GEM
157
160
  rackup (2.1.0)
158
161
  rack (>= 3)
159
162
  webrick (~> 1.8)
160
- rails (7.1.1)
161
- actioncable (= 7.1.1)
162
- actionmailbox (= 7.1.1)
163
- actionmailer (= 7.1.1)
164
- actionpack (= 7.1.1)
165
- actiontext (= 7.1.1)
166
- actionview (= 7.1.1)
167
- activejob (= 7.1.1)
168
- activemodel (= 7.1.1)
169
- activerecord (= 7.1.1)
170
- activestorage (= 7.1.1)
171
- activesupport (= 7.1.1)
163
+ rails (7.1.3.2)
164
+ actioncable (= 7.1.3.2)
165
+ actionmailbox (= 7.1.3.2)
166
+ actionmailer (= 7.1.3.2)
167
+ actionpack (= 7.1.3.2)
168
+ actiontext (= 7.1.3.2)
169
+ actionview (= 7.1.3.2)
170
+ activejob (= 7.1.3.2)
171
+ activemodel (= 7.1.3.2)
172
+ activerecord (= 7.1.3.2)
173
+ activestorage (= 7.1.3.2)
174
+ activesupport (= 7.1.3.2)
172
175
  bundler (>= 1.15.0)
173
- railties (= 7.1.1)
176
+ railties (= 7.1.3.2)
174
177
  rails-dom-testing (2.2.0)
175
178
  activesupport (>= 5.0.0)
176
179
  minitest
@@ -178,74 +181,74 @@ GEM
178
181
  rails-html-sanitizer (1.6.0)
179
182
  loofah (~> 2.21)
180
183
  nokogiri (~> 1.14)
181
- railties (7.1.1)
182
- actionpack (= 7.1.1)
183
- activesupport (= 7.1.1)
184
+ railties (7.1.3.2)
185
+ actionpack (= 7.1.3.2)
186
+ activesupport (= 7.1.3.2)
184
187
  irb
185
188
  rackup (>= 1.0.0)
186
189
  rake (>= 12.2)
187
190
  thor (~> 1.0, >= 1.2.2)
188
191
  zeitwerk (~> 2.6)
189
192
  rainbow (3.1.1)
190
- rake (13.0.6)
191
- rdoc (6.5.0)
193
+ rake (13.1.0)
194
+ rdoc (6.6.2)
192
195
  psych (>= 4.0.0)
193
- regexp_parser (2.8.2)
194
- reline (0.3.9)
196
+ regexp_parser (2.9.0)
197
+ reline (0.4.2)
195
198
  io-console (~> 0.5)
196
199
  rexml (3.2.6)
197
- rspec (3.12.0)
198
- rspec-core (~> 3.12.0)
199
- rspec-expectations (~> 3.12.0)
200
- rspec-mocks (~> 3.12.0)
201
- rspec-core (3.12.1)
202
- rspec-support (~> 3.12.0)
203
- rspec-expectations (3.12.2)
200
+ rspec (3.13.0)
201
+ rspec-core (~> 3.13.0)
202
+ rspec-expectations (~> 3.13.0)
203
+ rspec-mocks (~> 3.13.0)
204
+ rspec-core (3.13.0)
205
+ rspec-support (~> 3.13.0)
206
+ rspec-expectations (3.13.0)
204
207
  diff-lcs (>= 1.2.0, < 2.0)
205
- rspec-support (~> 3.12.0)
206
- rspec-mocks (3.12.3)
208
+ rspec-support (~> 3.13.0)
209
+ rspec-mocks (3.13.0)
207
210
  diff-lcs (>= 1.2.0, < 2.0)
208
- rspec-support (~> 3.12.0)
209
- rspec-support (3.12.0)
210
- rubocop (1.57.1)
211
- base64 (~> 0.1.1)
211
+ rspec-support (~> 3.13.0)
212
+ rspec-support (3.13.1)
213
+ rubocop (1.62.1)
212
214
  json (~> 2.3)
213
215
  language_server-protocol (>= 3.17.0)
214
216
  parallel (~> 1.10)
215
- parser (>= 3.2.2.4)
217
+ parser (>= 3.3.0.2)
216
218
  rainbow (>= 2.2.2, < 4.0)
217
219
  regexp_parser (>= 1.8, < 3.0)
218
220
  rexml (>= 3.2.5, < 4.0)
219
- rubocop-ast (>= 1.28.1, < 2.0)
221
+ rubocop-ast (>= 1.31.1, < 2.0)
220
222
  ruby-progressbar (~> 1.7)
221
223
  unicode-display_width (>= 2.4.0, < 3.0)
222
- rubocop-ast (1.29.0)
223
- parser (>= 3.2.1.0)
224
- rubocop-capybara (2.19.0)
224
+ rubocop-ast (1.31.2)
225
+ parser (>= 3.3.0.4)
226
+ rubocop-capybara (2.20.0)
227
+ rubocop (~> 1.41)
228
+ rubocop-factory_bot (2.25.1)
225
229
  rubocop (~> 1.41)
226
- rubocop-factory_bot (2.24.0)
227
- rubocop (~> 1.33)
228
- rubocop-rails (2.21.2)
230
+ rubocop-rails (2.24.0)
229
231
  activesupport (>= 4.2.0)
230
232
  rack (>= 1.1)
231
233
  rubocop (>= 1.33.0, < 2.0)
234
+ rubocop-ast (>= 1.31.1, < 2.0)
232
235
  rubocop-rake (0.6.0)
233
236
  rubocop (~> 1.0)
234
- rubocop-rspec (2.24.1)
235
- rubocop (~> 1.33)
237
+ rubocop-rspec (2.27.1)
238
+ rubocop (~> 1.40)
236
239
  rubocop-capybara (~> 2.17)
237
240
  rubocop-factory_bot (~> 2.22)
238
241
  ruby-progressbar (1.13.0)
239
- ruby2_keywords (0.0.5)
240
242
  simplecov (0.22.0)
241
243
  docile (~> 1.1)
242
244
  simplecov-html (~> 0.11)
243
245
  simplecov_json_formatter (~> 0.1)
244
246
  simplecov-html (0.12.3)
245
247
  simplecov_json_formatter (0.1.4)
246
- stringio (3.0.8)
248
+ stringio (3.1.0)
249
+ tdiff (0.4.0)
247
250
  thor (1.3.0)
248
- timeout (0.4.0)
251
+ timeout (0.4.1)
249
252
  tzinfo (2.0.6)
250
253
  concurrent-ruby (~> 1.0)
251
254
  unicode-display_width (2.5.0)
@@ -255,8 +258,8 @@ GEM
255
258
  websocket-extensions (0.1.5)
256
259
  xpath (3.2.0)
257
260
  nokogiri (~> 1.8)
258
- yard (0.9.34)
259
- zeitwerk (2.6.12)
261
+ yard (0.9.36)
262
+ zeitwerk (2.6.13)
260
263
 
261
264
  PLATFORMS
262
265
  x86_64-darwin-19
@@ -265,14 +268,15 @@ PLATFORMS
265
268
 
266
269
  DEPENDENCIES
267
270
  bundler (~> 2.3)
268
- capybara (~> 3.39.2)
271
+ capybara (~> 3.40.0)
269
272
  ccs-frontend_helpers!
270
- rake (~> 13.0)
271
- rspec (~> 3.12)
272
- rubocop (~> 1.57)
273
- rubocop-rails (~> 2.21)
273
+ nokogiri-diff (~> 0.3.0)
274
+ rake (~> 13.1)
275
+ rspec (~> 3.13)
276
+ rubocop (~> 1.62)
277
+ rubocop-rails (~> 2.24)
274
278
  rubocop-rake (~> 0.6)
275
- rubocop-rspec (~> 2.24)
279
+ rubocop-rspec (~> 2.27)
276
280
  simplecov (~> 0.21)
277
281
  yard (~> 0.9)
278
282
 
data/README.md CHANGED
@@ -8,6 +8,17 @@ This project contains two applications (both use the Ruby on Rails framework):
8
8
  - [Crown Marketplace](https://github.com/Crown-Commercial-Service/crown-marketplace)
9
9
  - [Crown Marketplace Legacy](https://github.com/Crown-Commercial-Service/crown-marketplace-legacy)
10
10
 
11
+ ## Compatibility
12
+
13
+ The following table shows the version of CCS Frontend Helpers that you should use for your targeted version of GOV.UK Frontend:
14
+
15
+ | CCS Frontend Helpers Version | Target GOV.UK Frontend Version |
16
+ | ----------------------------- | ------------------------------ |
17
+ | [0.2.0](https://github.com/tim-s-ccs/ccs-frontend_helpers/releases/tag/v0.2.0) | [5.2.0](https://github.com/alphagov/govuk-frontend/releases/tag/v5.2.0) |
18
+ | [0.1.2](https://github.com/tim-s-ccs/ccs-frontend_helpers/releases/tag/v0.1.2) | [4.7.0](https://github.com/alphagov/govuk-frontend/releases/tag/v4.7.0) |
19
+
20
+ Any other versions of GOV.UK Frontend not shown above _may_ still be compatible, but have not been specifically tested and verified.
21
+
11
22
  ## Installation
12
23
 
13
24
  Install the gem and add to the application's Gemfile by executing:
@@ -41,7 +41,7 @@ module CCS
41
41
  # @return [ActiveSupport::SafeBuffer]
42
42
 
43
43
  def render
44
- tag.div(class: 'govuk-accordion__section-content', id: "#{accordion_id}-content-#{index}", aria: { labelledby: "#{accordion_id}-heading-#{index}" }) do
44
+ tag.div(class: 'govuk-accordion__section-content', id: "#{accordion_id}-content-#{index}") do
45
45
  section[:content] || tag.p(section[:text], class: 'govuk-body')
46
46
  end
47
47
  end
@@ -28,6 +28,12 @@ module CCS
28
28
  #
29
29
  # @option options [String] :classes additional CSS classes for the accordion HTML
30
30
  # @option options [Integer] :heading_level (2) heading level, from 1 to 6
31
+ # @option options [String] :hide_all_sections_text The text content of the ‘Hide all sections’ button at the top of the accordion when all sections are expanded
32
+ # @option options [String] :hide_section_text The text content of the ‘Hide’ button within each section of the accordion, which is visible when the section is expanded
33
+ # @option options [String] :hide_section_aria_label_text Text made available to assistive technologies, like screen-readers, as the final part of the toggle’s accessible name when the section is expanded. Defaults to "Hide this section".
34
+ # @option options [String] :show_all_sections_text The text content of the ‘Show all sections’ button at the top of the accordion when at least one section is collapsed
35
+ # @option options [String] :show_section_text The text content of the ‘Show’ button within each section of the accordion, which is visible when the section is collapsed
36
+ # @option options [String] :show_section_aria_label_text Text made available to assistive technologies, like screen-readers, as the final part of the toggle’s accessible name when the section is collapsed. Defaults to "Show this section".
31
37
  # @option options [Hash] :attributes any additional attributes that will added as part of the HTML
32
38
 
33
39
  def initialize(accordion_id:, accordion_sections:, **options)
@@ -36,6 +42,11 @@ module CCS
36
42
  @options[:attributes][:id] = accordion_id
37
43
  @options[:heading_level] ||= 2
38
44
 
45
+ %i[hide_all_sections hide_section hide_section_aria_label show_all_sections show_section show_section_aria_label].each do |data_attribute|
46
+ data_attribute_name = :"#{data_attribute}_text"
47
+ @options[:attributes][:data][:"i18n.#{data_attribute.to_s.gsub('_', '-')}"] = options[data_attribute_name] if options[data_attribute_name]
48
+ end
49
+
39
50
  @accordion_sections = accordion_sections.map.with_index(1) { |accordion_section, index| Section.new(section: accordion_section, accordion_id: accordion_id, index: index, heading_level: @options[:heading_level]) }
40
51
  end
41
52
 
@@ -32,7 +32,10 @@ module CCS
32
32
  def initialize(text:, **options)
33
33
  super(**options)
34
34
 
35
- @options[:attributes][:class] << ' govuk-button--disabled' if @options[:attributes][:disabled]
35
+ if @options[:attributes][:disabled]
36
+ @options[:attributes][:aria] ||= {}
37
+ @options[:attributes][:aria][:disabled] = true
38
+ end
36
39
  @options[:attributes][:class] << ' govuk-button--start' if @options[:is_start_button]
37
40
 
38
41
  @text = text
@@ -46,6 +46,7 @@ module CCS
46
46
  if href && options[:attributes][:type] != :button
47
47
  link_to(text, href, **options[:attributes])
48
48
  else
49
+ options[:attributes][:type] ||= :button
49
50
  Button.new(text: text, href: href, context: context, **options).render
50
51
  end
51
52
  end
@@ -56,7 +56,7 @@ module CCS
56
56
  tag.div(class: 'govuk-grid-column-two-thirds') do
57
57
  concat(tag.h2(heading_text, class: 'govuk-cookie-banner__heading govuk-heading-m')) if heading_text
58
58
  concat(tag.div(class: 'govuk-cookie-banner__content') do
59
- content || tag.p(text, class: 'govuk-body')
59
+ content || tag.p(text, class: 'govuk-body') if content || text
60
60
  end)
61
61
  end
62
62
  end)
@@ -46,7 +46,7 @@ module CCS
46
46
 
47
47
  # The default attributes for the details
48
48
 
49
- DEFAULT_ATTRIBUTES = { class: 'govuk-details', data: { module: 'govuk-details' } }.freeze
49
+ DEFAULT_ATTRIBUTES = { class: 'govuk-details' }.freeze
50
50
  end
51
51
  end
52
52
  end
@@ -33,7 +33,7 @@ module CCS
33
33
  def initialize(message:, attribute:, **options)
34
34
  super(**options)
35
35
 
36
- @options[:attributes][:id] ||= "#{attribute}-error"
36
+ @options[:attributes][:id] ||= "#{attribute}-error" if attribute
37
37
 
38
38
  @message = message
39
39
  @attribute = attribute
@@ -46,7 +46,10 @@ module CCS
46
46
 
47
47
  def render
48
48
  tag.p(**options[:attributes]) do
49
- concat(tag.span("#{visually_hidden_text}: ", class: 'govuk-visually-hidden')) if visually_hidden_text.present?
49
+ if visually_hidden_text.present?
50
+ concat(tag.span("#{visually_hidden_text}:", class: 'govuk-visually-hidden'))
51
+ concat(' ')
52
+ end
50
53
  concat(message)
51
54
  end
52
55
  end