govuk_publishing_components 34.0.0 → 34.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-core.js +16 -27
  3. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-event-tracker.js +2 -0
  4. data/app/assets/javascripts/govuk_publishing_components/analytics-ga4/ga4-page-views.js +4 -4
  5. data/app/assets/javascripts/govuk_publishing_components/components/layout-super-navigation-header.js +12 -69
  6. data/app/assets/javascripts/govuk_publishing_components/components/step-by-step-nav.js +14 -13
  7. data/app/assets/stylesheets/govuk_publishing_components/components/_layout-super-navigation-header.scss +247 -412
  8. data/app/assets/stylesheets/govuk_publishing_components/components/helpers/_brand-colours.scss +2 -2
  9. data/app/controllers/govuk_publishing_components/audit_controller.rb +1 -1
  10. data/app/models/govuk_publishing_components/audit_comparer.rb +1 -1
  11. data/app/models/govuk_publishing_components/audit_components.rb +103 -82
  12. data/app/views/govuk_publishing_components/audit/_applications.html.erb +1 -1
  13. data/app/views/govuk_publishing_components/audit/_component_contents.html.erb +47 -39
  14. data/app/views/govuk_publishing_components/audit/_components.html.erb +1 -1
  15. data/app/views/govuk_publishing_components/components/_cookie_banner.html.erb +2 -2
  16. data/app/views/govuk_publishing_components/components/_label.html.erb +3 -2
  17. data/app/views/govuk_publishing_components/components/_layout_super_navigation_header.html.erb +94 -143
  18. data/app/views/govuk_publishing_components/components/docs/label.yml +6 -0
  19. data/config/locales/ar.yml +4 -1
  20. data/config/locales/az.yml +4 -1
  21. data/config/locales/be.yml +4 -1
  22. data/config/locales/bg.yml +4 -1
  23. data/config/locales/bn.yml +4 -1
  24. data/config/locales/cs.yml +4 -1
  25. data/config/locales/cy.yml +4 -1
  26. data/config/locales/da.yml +4 -1
  27. data/config/locales/de.yml +4 -1
  28. data/config/locales/dr.yml +4 -1
  29. data/config/locales/el.yml +4 -1
  30. data/config/locales/en.yml +6 -10
  31. data/config/locales/es-419.yml +4 -1
  32. data/config/locales/es.yml +4 -1
  33. data/config/locales/et.yml +4 -1
  34. data/config/locales/fa.yml +4 -1
  35. data/config/locales/fi.yml +4 -1
  36. data/config/locales/fr.yml +4 -1
  37. data/config/locales/gd.yml +4 -1
  38. data/config/locales/gu.yml +4 -1
  39. data/config/locales/he.yml +4 -1
  40. data/config/locales/hi.yml +4 -1
  41. data/config/locales/hr.yml +4 -1
  42. data/config/locales/hu.yml +4 -1
  43. data/config/locales/hy.yml +4 -1
  44. data/config/locales/id.yml +4 -1
  45. data/config/locales/is.yml +4 -1
  46. data/config/locales/it.yml +4 -1
  47. data/config/locales/ja.yml +4 -1
  48. data/config/locales/ka.yml +4 -1
  49. data/config/locales/kk.yml +4 -1
  50. data/config/locales/ko.yml +4 -1
  51. data/config/locales/lt.yml +4 -1
  52. data/config/locales/lv.yml +4 -1
  53. data/config/locales/ms.yml +4 -1
  54. data/config/locales/mt.yml +4 -1
  55. data/config/locales/nl.yml +4 -1
  56. data/config/locales/no.yml +4 -1
  57. data/config/locales/pa-pk.yml +4 -1
  58. data/config/locales/pa.yml +4 -1
  59. data/config/locales/pl.yml +4 -1
  60. data/config/locales/ps.yml +4 -1
  61. data/config/locales/pt.yml +4 -1
  62. data/config/locales/ro.yml +4 -1
  63. data/config/locales/ru.yml +4 -1
  64. data/config/locales/si.yml +4 -1
  65. data/config/locales/sk.yml +4 -1
  66. data/config/locales/sl.yml +4 -1
  67. data/config/locales/so.yml +4 -1
  68. data/config/locales/sq.yml +4 -1
  69. data/config/locales/sr.yml +4 -1
  70. data/config/locales/sv.yml +4 -1
  71. data/config/locales/sw.yml +4 -1
  72. data/config/locales/ta.yml +4 -1
  73. data/config/locales/th.yml +4 -1
  74. data/config/locales/tk.yml +4 -1
  75. data/config/locales/tr.yml +4 -1
  76. data/config/locales/uk.yml +4 -1
  77. data/config/locales/ur.yml +4 -1
  78. data/config/locales/uz.yml +4 -1
  79. data/config/locales/vi.yml +4 -1
  80. data/config/locales/zh-hk.yml +4 -1
  81. data/config/locales/zh-tw.yml +4 -1
  82. data/config/locales/zh.yml +4 -1
  83. data/lib/govuk_publishing_components/version.rb +1 -1
  84. data/node_modules/axe-core/axe.d.ts +76 -24
  85. data/node_modules/axe-core/axe.js +4765 -4555
  86. data/node_modules/axe-core/axe.min.js +2 -2
  87. data/node_modules/axe-core/package.json +2 -2
  88. data/node_modules/axe-core/sri-history.json +8 -0
  89. metadata +2 -2
@@ -57,12 +57,12 @@
57
57
 
58
58
  .brand--prime-ministers-office-10-downing-street {
59
59
  .brand__color {
60
- color: govuk-colour("bright-purple");
60
+ color: govuk-colour("black");
61
61
 
62
62
  &:link,
63
63
  &:visited,
64
64
  &:active {
65
- color: govuk-colour("bright-purple");
65
+ color: govuk-colour("black");
66
66
  }
67
67
 
68
68
  &:hover,
@@ -34,7 +34,7 @@ module GovukPublishingComponents
34
34
  @in_application = false
35
35
  @in_application = true unless ENV["MAIN_COMPONENT_GUIDE"]
36
36
 
37
- components = AuditComponents.new(gem_path, false)
37
+ components = AuditComponents.new(gem_path)
38
38
  applications = analyse_applications(host_dir, application_dirs)
39
39
  compared_data = AuditComparer.new(components.data, applications)
40
40
 
@@ -252,7 +252,7 @@ module GovukPublishingComponents
252
252
  results = []
253
253
  found_something = false
254
254
 
255
- @gem_data[:component_listing].each do |component|
255
+ @gem_data[:component_file_details].each do |component|
256
256
  component_name = component[:name]
257
257
  locations = []
258
258
 
@@ -2,65 +2,123 @@ module GovukPublishingComponents
2
2
  class AuditComponents
3
3
  attr_reader :data
4
4
 
5
- def initialize(path, simple)
6
- @data = {
7
- gem_found: false,
8
- }
9
- @data = compile_data(path, simple) if Dir.exist?(path)
10
- end
11
-
12
- private
13
-
14
- def compile_data(path, simple)
15
- # simple is used to reduce effort (and therefore page load time) required
16
- # when loading auditing summary on the main component guide page
17
- @simple = simple
18
-
5
+ def initialize(path)
19
6
  # paths to key file locations
20
7
  @templates_path = "app/views/govuk_publishing_components/components"
21
8
  @stylesheets_path = "app/assets/stylesheets/govuk_publishing_components/components"
22
9
  @print_stylesheets_path = "app/assets/stylesheets/govuk_publishing_components/components/print"
23
10
  @javascripts_path = "app/assets/javascripts/govuk_publishing_components/components"
24
11
  @tests_path = "spec/components"
25
- @js_tests_path = "spec/javascripts/components"
12
+ @javascript_tests_path = "spec/javascripts/components"
26
13
  @helpers_path = "lib/govuk_publishing_components/presenters"
27
14
 
28
- # get all files in key file locations
29
- templates = Dir["#{path}/#{@templates_path}/*.erb"]
30
- stylesheets = Dir["#{path}/#{@stylesheets_path}/*.scss"]
31
- print_stylesheets = Dir["#{path}/#{@print_stylesheets_path}/*.scss"]
32
- javascripts = Dir["#{path}/#{@javascripts_path}/*.js"]
33
- tests = Dir["#{path}/#{@tests_path}/*.rb"]
34
- js_tests = Dir["#{path}/#{@js_tests_path}/*.js"]
35
- helpers = Dir["#{path}/#{@helpers_path}/*_helper.rb"]
36
-
15
+ @all_templates = Dir["#{path}/#{@templates_path}/*.erb"].sort
37
16
  @templates_full_path = "#{path}/#{@templates_path}/"
38
17
 
39
- # find the cleaned names of components in key file locations
40
- # i.e. will show that 'component name' has a stylesheet
41
- # standardised like this to be used later for easier comparison
42
- @components = clean_files(templates, [path, @templates_path].join("/"))
43
- @component_stylesheets = clean_files(stylesheets, [path, @stylesheets_path].join("/"))
44
- @component_print_stylesheets = clean_files(print_stylesheets, [path, @print_stylesheets_path].join("/"))
45
- @component_javascripts = clean_files(javascripts, [path, @javascripts_path].join("/"))
46
- @component_tests = clean_files(tests, [path, @tests_path].join("/"))
47
- @component_js_tests = clean_files(js_tests, [path, @js_tests_path].join("/"))
48
- @component_helpers = clean_files(helpers, [path, @helpers_path].join("/"))
18
+ @component_numbers = {
19
+ template: 0,
20
+ stylesheet: 0,
21
+ print_stylesheet: 0,
22
+ javascript: 0,
23
+ test: 0,
24
+ javascript_test: 0,
25
+ helper: 0,
26
+ }
49
27
 
28
+ @data = {
29
+ gem_found: false,
30
+ }
31
+ @data = compile_data(path) if Dir.exist?(path)
32
+ end
33
+
34
+ private
35
+
36
+ def compile_data(path)
50
37
  {
51
38
  gem_found: true,
52
- component_code: @components,
53
- component_stylesheets: @component_stylesheets,
54
- component_print_stylesheets: @component_print_stylesheets,
55
- component_javascripts: @component_javascripts,
56
- component_tests: @component_tests,
57
- component_js_tests: @component_js_tests,
58
- component_helpers: @component_helpers,
59
- components_containing_components: find_all_partials_in(templates),
60
- component_listing: list_all_component_details,
39
+ component_code: clean_files(@all_templates, @templates_full_path).sort,
40
+ components_containing_components: find_all_partials_in(@all_templates),
41
+ component_file_details: get_component_file_details(path),
42
+ component_numbers: @component_numbers,
61
43
  }
62
44
  end
63
45
 
46
+ def get_component_file_details(path)
47
+ component_templates = clean_files(@all_templates, @templates_full_path).sort
48
+ details = []
49
+ component_templates.each do |component|
50
+ component_detail = {
51
+ name: component,
52
+ link: get_component_link(component),
53
+ }
54
+ file_details = [
55
+ {
56
+ type: "template",
57
+ file: "#{[path, @templates_path].join('/')}/_#{component.gsub(' ', '_')}.html.erb",
58
+ },
59
+ {
60
+ type: "stylesheet",
61
+ file: "#{[path, @stylesheets_path].join('/')}/_#{component.gsub(' ', '-')}.scss",
62
+ },
63
+ {
64
+ type: "print_stylesheet",
65
+ file: "#{[path, @stylesheets_path].join('/')}/_#{component.gsub(' ', '-')}.scss",
66
+ },
67
+ {
68
+ type: "javascript",
69
+ file: "#{[path, @javascripts_path].join('/')}/#{component.gsub(' ', '-')}.js",
70
+ },
71
+ {
72
+ type: "test",
73
+ file: "#{[path, @tests_path].join('/')}/#{component.gsub(' ', '_')}_spec.rb",
74
+ },
75
+ {
76
+ type: "javascript_test",
77
+ file: "#{[path, @javascript_tests_path].join('/')}/#{component.gsub(' ', '-')}-spec.js",
78
+ },
79
+ {
80
+ type: "helper",
81
+ file: "#{[path, @helpers_path].join('/')}/#{component.gsub(' ', '_')}_helper.rb",
82
+ },
83
+ ]
84
+ file_details.each do |detail|
85
+ component_detail = component_detail.merge(get_component_asset_detail(detail, component))
86
+ end
87
+
88
+ details << component_detail
89
+ end
90
+
91
+ details
92
+ end
93
+
94
+ def get_component_asset_detail(detail, component)
95
+ details = {}
96
+ type = detail[:type]
97
+ file = detail[:file]
98
+ details["#{type}_exists".to_sym] = false
99
+ if File.file?(file)
100
+ # we don't have separate print stylesheets anymore
101
+ # so check the main stylesheet for print styles
102
+ if type == "print_stylesheet"
103
+ unless File.foreach(file).grep(/(media-type: print)/).empty?
104
+ details["#{type}_exists".to_sym] = true
105
+ @component_numbers[type.to_sym] += 1
106
+ end
107
+ else
108
+ @component_numbers[type.to_sym] += 1
109
+ details["#{type}_exists".to_sym] = true
110
+ details["#{type}_lines".to_sym] = count_lines_in(file)
111
+ details["#{type}_link".to_sym] = get_asset_link(type, component)
112
+ end
113
+ end
114
+
115
+ details
116
+ end
117
+
118
+ def count_lines_in(file)
119
+ File.read(file).each_line.count
120
+ end
121
+
64
122
  def clean_files(files, replace)
65
123
  files.map { |file| clean_file_name(file.gsub(replace, "")) }.sort
66
124
  end
@@ -91,8 +149,6 @@ module GovukPublishingComponents
91
149
  end
92
150
 
93
151
  def find_all_partials_in(templates)
94
- return [] if @simple
95
-
96
152
  components = []
97
153
 
98
154
  templates.each do |template|
@@ -144,52 +200,17 @@ module GovukPublishingComponents
144
200
  end
145
201
  end
146
202
 
147
- def list_all_component_details
148
- return [] if @simple
149
-
150
- all_component_information = []
151
-
152
- @components.each do |component|
153
- all_component_information << {
154
- name: component,
155
- link: get_component_link(component),
156
- stylesheet: check_component_has("stylesheet", component),
157
- print_stylesheet: check_component_has("print_stylesheet", component),
158
- javascript: check_component_has("javascript", component),
159
- tests: check_component_has("test", component),
160
- js_tests: check_component_has("js_test", component),
161
- helper: check_component_has("helper", component),
162
- }
163
- end
164
-
165
- all_component_information
166
- end
167
-
168
- def check_component_has(a_thing, component)
169
- look_in = @component_stylesheets if a_thing == "stylesheet"
170
- look_in = @component_print_stylesheets if a_thing == "print_stylesheet"
171
- look_in = @component_javascripts if a_thing == "javascript"
172
- look_in = @component_tests if a_thing == "test"
173
- look_in = @component_js_tests if a_thing == "js_test"
174
- look_in = @component_helpers if a_thing == "helper"
175
-
176
- if look_in.include?(component)
177
- return get_asset_link(a_thing, component)
178
- end
179
-
180
- false
181
- end
182
-
183
203
  def get_asset_link(a_thing, component)
184
204
  url = "https://github.com/alphagov"
185
205
  repo = "govuk_publishing_components"
186
206
  blob = "blob/main"
187
207
  link = nil
208
+ link = "#{url}/#{repo}/#{blob}/#{@templates_path}/_#{component.gsub(' ', '_')}.html.erb" if a_thing == "template"
188
209
  link = "#{url}/#{repo}/#{blob}/#{@stylesheets_path}/_#{component.gsub(' ', '-')}.scss" if a_thing == "stylesheet"
189
210
  link = "#{url}/#{repo}/#{blob}/#{@print_stylesheets_path}/_#{component.gsub(' ', '-')}.scss" if a_thing == "print_stylesheet"
190
211
  link = "#{url}/#{repo}/#{blob}/#{@javascripts_path}/#{component.gsub(' ', '-')}.js" if a_thing == "javascript"
191
212
  link = "#{url}/#{repo}/#{blob}/#{@tests_path}/#{component.gsub(' ', '_')}_spec.rb" if a_thing == "test"
192
- link = "#{url}/#{repo}/#{blob}/#{@js_tests_path}/#{component.gsub(' ', '-')}-spec.js" if a_thing == "js_test"
213
+ link = "#{url}/#{repo}/#{blob}/#{@javascript_tests_path}/#{component.gsub(' ', '-')}-spec.js" if a_thing == "javascript_test"
193
214
  link = "#{url}/#{repo}/#{blob}/#{@helpers_path}/#{component.gsub(' ', '_')}_helper.rb" if a_thing == "helper"
194
215
 
195
216
  link
@@ -12,7 +12,7 @@
12
12
  <%= render "govuk_publishing_components/components/details", {
13
13
  title: "How to use this information"
14
14
  } do %>
15
- <p class="govuk-body">This page shows information about component use on GOV.UK. This information has been cross referenced with the components in the gem to produce warnings where e.g. a print stylesheet for a component exists but has not been included in an application.</p>
15
+ <p class="govuk-body">This page shows information about component use on GOV.UK. This information has been cross referenced with the components in the gem to produce warnings where e.g. JavaScript for a component exists but has not been included in an application.</p>
16
16
  <p class="govuk-body">Warnings should be investigated, although there may be a reason why the application has been configured as it is. Note that 'code' can refer to templates or ruby code.</p>
17
17
  <% end %>
18
18
 
@@ -1,78 +1,86 @@
1
- <%
2
- total_components = components.length
3
- components_with_stylesheet = 0
4
- components_with_print_stylesheet = 0
5
- components_with_javascript = 0
6
- components_with_test = 0
7
- components_with_javascript_test = 0
8
- components_with_helper = 0
9
-
10
- components.each do |component|
11
- components_with_stylesheet += 1 if component[:stylesheet]
12
- components_with_print_stylesheet += 1 if component[:print_stylesheet]
13
- components_with_javascript += 1 if component[:javascript]
14
- components_with_test += 1 if component[:tests]
15
- components_with_javascript_test += 1 if component[:js_tests]
16
- components_with_helper += 1 if component[:helper]
17
- end
18
- %>
19
1
  <table class="govuk-table">
20
2
  <thead class="govuk-table__head">
21
3
  <tr class="govuk-table__row">
22
- <th scope="col" class="govuk-table__header sticky-table-header">Component (<%= total_components %>)</th>
23
- <th scope="col" class="govuk-table__header sticky-table-header">CSS (<%= components_with_stylesheet %>)</th>
24
- <th scope="col" class="govuk-table__header sticky-table-header">Print CSS (<%= components_with_print_stylesheet %>)</th>
25
- <th scope="col" class="govuk-table__header sticky-table-header">JS (<%= components_with_javascript %>)</th>
26
- <th scope="col" class="govuk-table__header sticky-table-header">Test (<%= components_with_test %>)</th>
27
- <th scope="col" class="govuk-table__header sticky-table-header">JS test (<%= components_with_javascript_test %>)</th>
28
- <th scope="col" class="govuk-table__header sticky-table-header">Helper (<%= components_with_helper %>)</th>
4
+ <th scope="col" class="govuk-table__header sticky-table-header">Component</th>
5
+ <th scope="col" class="govuk-table__header sticky-table-header">Template (<%= @components[:component_numbers][:template] %>)</th>
6
+ <th scope="col" class="govuk-table__header sticky-table-header">CSS (<%= @components[:component_numbers][:stylesheet] %>)</th>
7
+ <th scope="col" class="govuk-table__header sticky-table-header">Print styles (<%= @components[:component_numbers][:print_stylesheet] %>)</th>
8
+ <th scope="col" class="govuk-table__header sticky-table-header">JS (<%= @components[:component_numbers][:javascript] %>)</th>
9
+ <th scope="col" class="govuk-table__header sticky-table-header">Test (<%= @components[:component_numbers][:test] %>)</th>
10
+ <th scope="col" class="govuk-table__header sticky-table-header">JS test (<%= @components[:component_numbers][:javascript_test] %>)</th>
11
+ <th scope="col" class="govuk-table__header sticky-table-header">Helper (<%= @components[:component_numbers][:helper] %>)</th>
29
12
  </tr>
30
13
  </thead>
31
14
  <tbody class="govuk-table__body">
32
- <% components.each do |component| %>
15
+ <% @components[:component_file_details].each do |component| %>
33
16
  <tr class="govuk-table__row">
34
17
  <th scope="row" class="govuk-table__header">
35
- <a href="<%= component[:link] %>" class="govuk-link"><%= component[:name] %></a>
18
+ <a href="<%= component[:link] %>" class="govuk-link">
19
+ <%= component[:name] %>
20
+ </a>
36
21
  </th>
37
22
  <td class="govuk-table__cell">
38
- <% if component[:stylesheet] %>
23
+ <% if component[:template_exists] %>
39
24
  <strong class="govuk-tag govuk-tag--green">
40
- <a href="<%= component[:stylesheet] %>" class="govuk-link">Yes</a>
25
+ <a href="<%= component[:template_link] %>" class="govuk-link">
26
+ <%= component[:template_lines] %>
27
+ <span class="govuk-visually-hidden">lines of code in <%= component[:name] %> template</span>
28
+ </a>
41
29
  </strong>
42
30
  <% end %>
43
31
  </td>
44
32
  <td class="govuk-table__cell">
45
- <% if component[:print_stylesheet] %>
33
+ <% if component[:stylesheet_exists] %>
46
34
  <strong class="govuk-tag govuk-tag--green">
47
- <a href="<%= component[:print_stylesheet] %>" class="govuk-link">Yes</a>
35
+ <a href="<%= component[:stylesheet_link] %>" class="govuk-link">
36
+ <%= component[:stylesheet_lines] %>
37
+ <span class="govuk-visually-hidden">lines of code in <%= component[:name] %> stylesheet</span>
38
+ </a>
48
39
  </strong>
49
40
  <% end %>
50
41
  </td>
51
42
  <td class="govuk-table__cell">
52
- <% if component[:javascript] %>
43
+ <% if component[:print_stylesheet_exists] %>
44
+ <strong class="govuk-tag govuk-tag--green">Yes</strong>
45
+ <% end %>
46
+ </td>
47
+ <td class="govuk-table__cell">
48
+ <% if component[:javascript_exists] %>
53
49
  <strong class="govuk-tag govuk-tag--green">
54
- <a href="<%= component[:javascript] %>" class="govuk-link">Yes</a>
50
+ <a href="<%= component[:javascript_link] %>" class="govuk-link">
51
+ <%= component[:javascript_lines] %>
52
+ <span class="govuk-visually-hidden">lines of code in <%= component[:name] %> javascript</span>
53
+ </a>
55
54
  </strong>
56
55
  <% end %>
57
56
  </td>
58
57
  <td class="govuk-table__cell">
59
- <% if component[:tests] %>
58
+ <% if component[:test_exists] %>
60
59
  <strong class="govuk-tag govuk-tag--green">
61
- <a href="<%= component[:tests] %>" class="govuk-link">Yes</a>
60
+ <a href="<%= component[:test_link] %>" class="govuk-link">
61
+ <%= component[:test_lines] %>
62
+ <span class="govuk-visually-hidden">lines of code in <%= component[:name] %> test</span>
63
+ </a>
62
64
  </strong>
63
65
  <% end %>
64
66
  </td>
65
67
  <td class="govuk-table__cell">
66
- <% if component[:js_tests] %>
68
+ <% if component[:javascript_test_exists] %>
67
69
  <strong class="govuk-tag govuk-tag--green">
68
- <a href="<%= component[:js_tests] %>" class="govuk-link">Yes</a>
70
+ <a href="<%= component[:javascript_test_link] %>" class="govuk-link">
71
+ <%= component[:javascript_test_lines] %>
72
+ <span class="govuk-visually-hidden">lines of code in <%= component[:name] %> javascript test</span>
73
+ </a>
69
74
  </strong>
70
75
  <% end %>
71
76
  </td>
72
77
  <td class="govuk-table__cell">
73
- <% if component[:helper] %>
78
+ <% if component[:helper_exists] %>
74
79
  <strong class="govuk-tag govuk-tag--green">
75
- <a href="<%= component[:helper] %>" class="govuk-link">Yes</a>
80
+ <a href="<%= component[:helper_link] %>" class="govuk-link">
81
+ <%= component[:helper_lines] %>
82
+ <span class="govuk-visually-hidden">lines of code in <%= component[:name] %> helper</span>
83
+ </a>
76
84
  </strong>
77
85
  <% end %>
78
86
  </td>
@@ -10,7 +10,7 @@
10
10
  <% component_items = [] %>
11
11
 
12
12
  <% component_files = capture do %>
13
- <%= render partial: "component_contents", locals: { components: @components[:component_listing] } %>
13
+ <%= render partial: "component_contents" %>
14
14
  <% end %>
15
15
 
16
16
  <%
@@ -29,8 +29,8 @@
29
29
  css_classes = %w(gem-c-cookie-banner govuk-clearfix)
30
30
  css_classes << "gem-c-cookie-banner--services" if services_cookies
31
31
  %>
32
- <div id="<%= id %>" class="<%= css_classes.join(' ') %>" data-module="cookie-banner" role="region" aria-label="cookie banner" data-nosnippet>
33
- <div class="govuk-cookie-banner js-banner-wrapper" role="region" aria-label="<%= title %>">
32
+ <div id="<%= id %>" class="<%= css_classes.join(' ') %>" data-module="cookie-banner" data-nosnippet role="region" aria-label="<%= title %>">
33
+ <div class="govuk-cookie-banner js-banner-wrapper">
34
34
  <div class="gem-c-cookie-banner__message govuk-cookie-banner__message govuk-width-container">
35
35
  <div class="govuk-grid-row">
36
36
  <div class="govuk-grid-column-two-thirds">
@@ -2,6 +2,7 @@
2
2
  shared_helper = GovukPublishingComponents::Presenters::SharedHelper.new(local_assigns)
3
3
 
4
4
  hint_text ||= ""
5
+ id ||= nil
5
6
  is_radio_label ||= false
6
7
  bold ||= false
7
8
  heading_size = false unless shared_helper.valid_heading_size?(heading_size)
@@ -18,10 +19,10 @@
18
19
 
19
20
  <% if is_page_heading %>
20
21
  <%= tag.h1 text, class: "govuk-label-wrapper" do %>
21
- <%= tag.label text, for: html_for, class: css_classes %>
22
+ <%= tag.label text, id: id, for: html_for, class: css_classes %>
22
23
  <% end %>
23
24
  <% else %>
24
- <%= tag.label text, for: html_for, class: css_classes %>
25
+ <%= tag.label text, id: id, for: html_for, class: css_classes %>
25
26
  <% end %>
26
27
 
27
28
  <% if hint_text.present? %>