govuk-design-system-rails 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. checksums.yaml +7 -0
  2. data/app/helpers/govuk_design_system/accordion_helper.rb +7 -0
  3. data/app/helpers/govuk_design_system/back_link_helper.rb +13 -0
  4. data/app/helpers/govuk_design_system/breadcrumbs_helper.rb +7 -0
  5. data/app/helpers/govuk_design_system/button_helper.rb +71 -0
  6. data/app/helpers/govuk_design_system/checkboxes_helper.rb +8 -0
  7. data/app/helpers/govuk_design_system/components_helper.rb +13 -0
  8. data/app/helpers/govuk_design_system/cookie_banner_helper.rb +7 -0
  9. data/app/helpers/govuk_design_system/date_input_helper.rb +8 -0
  10. data/app/helpers/govuk_design_system/details_helper.rb +32 -0
  11. data/app/helpers/govuk_design_system/error_message_helper.rb +7 -0
  12. data/app/helpers/govuk_design_system/error_summary_helper.rb +20 -0
  13. data/app/helpers/govuk_design_system/fieldset_helper.rb +9 -0
  14. data/app/helpers/govuk_design_system/file_upload_helper.rb +59 -0
  15. data/app/helpers/govuk_design_system/header_helper.rb +7 -0
  16. data/app/helpers/govuk_design_system/hint_helper.rb +7 -0
  17. data/app/helpers/govuk_design_system/hmcts_badge_helper.rb +7 -0
  18. data/app/helpers/govuk_design_system/hmcts_banner_helper.rb +7 -0
  19. data/app/helpers/govuk_design_system/input_helper.rb +8 -0
  20. data/app/helpers/govuk_design_system/inset_text_helper.rb +9 -0
  21. data/app/helpers/govuk_design_system/label_helper.rb +7 -0
  22. data/app/helpers/govuk_design_system/notification_banner_helper.rb +8 -0
  23. data/app/helpers/govuk_design_system/phase_banner_helper.rb +21 -0
  24. data/app/helpers/govuk_design_system/radios_helper.rb +8 -0
  25. data/app/helpers/govuk_design_system/select_helper.rb +8 -0
  26. data/app/helpers/govuk_design_system/skip_link_helper.rb +13 -0
  27. data/app/helpers/govuk_design_system/summary_list_helper.rb +7 -0
  28. data/app/helpers/govuk_design_system/tabs_helper.rb +7 -0
  29. data/app/helpers/govuk_design_system/tag_helper.rb +8 -0
  30. data/app/helpers/govuk_design_system/textarea_helper.rb +8 -0
  31. data/app/helpers/govuk_design_system/warning_text_helper.rb +20 -0
  32. data/app/views/components/_govuk_accordion.html.erb +44 -0
  33. data/app/views/components/_govuk_action_link.html.erb +12 -0
  34. data/app/views/components/_govuk_breadcrumbs.html.erb +25 -0
  35. data/app/views/components/_govuk_checkboxes.html.erb +125 -0
  36. data/app/views/components/_govuk_cookie_banner.html.erb +75 -0
  37. data/app/views/components/_govuk_date_input.html.erb +94 -0
  38. data/app/views/components/_govuk_error_message.html.erb +13 -0
  39. data/app/views/components/_govuk_error_summary.html.erb +32 -0
  40. data/app/views/components/_govuk_fieldset.html.erb +21 -0
  41. data/app/views/components/_govuk_header.html.erb +64 -0
  42. data/app/views/components/_govuk_hint.html.erb +7 -0
  43. data/app/views/components/_govuk_hr.html.erb +1 -0
  44. data/app/views/components/_govuk_input.html.erb +97 -0
  45. data/app/views/components/_govuk_inset_text.html.erb +10 -0
  46. data/app/views/components/_govuk_label.html.erb +18 -0
  47. data/app/views/components/_govuk_notification_banner.html.erb +68 -0
  48. data/app/views/components/_govuk_radios.html.erb +141 -0
  49. data/app/views/components/_govuk_select.html.erb +105 -0
  50. data/app/views/components/_govuk_summary_list.html.erb +39 -0
  51. data/app/views/components/_govuk_tabs.html.erb +46 -0
  52. data/app/views/components/_govuk_textarea.html.erb +70 -0
  53. data/app/views/components/_hmcts_banner.html.erb +33 -0
  54. data/app/views/form_components/_govuk_checkboxes.html.erb +21 -0
  55. data/app/views/form_components/_govuk_date_input.html.erb +32 -0
  56. data/app/views/form_components/_govuk_input.html.erb +11 -0
  57. data/app/views/form_components/_govuk_radios.html.erb +24 -0
  58. data/app/views/form_components/_govuk_select.html.erb +25 -0
  59. data/app/views/form_components/_govuk_textarea.html.erb +11 -0
  60. data/lib/govuk-design-system-rails.rb +1 -0
  61. data/lib/govuk_design_system/engine.rb +50 -0
  62. data/lib/govuk_design_system.rb +4 -0
  63. data/spec/dummy/Rakefile +6 -0
  64. data/spec/dummy/app/assets/config/manifest.js +2 -0
  65. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  66. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  67. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  68. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  69. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  70. data/spec/dummy/app/javascript/packs/application.js +15 -0
  71. data/spec/dummy/app/jobs/application_job.rb +7 -0
  72. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  73. data/spec/dummy/app/models/application_record.rb +3 -0
  74. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  75. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  76. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  77. data/spec/dummy/bin/rails +4 -0
  78. data/spec/dummy/bin/rake +4 -0
  79. data/spec/dummy/bin/setup +33 -0
  80. data/spec/dummy/config/application.rb +38 -0
  81. data/spec/dummy/config/boot.rb +5 -0
  82. data/spec/dummy/config/cable.yml +10 -0
  83. data/spec/dummy/config/database.yml +25 -0
  84. data/spec/dummy/config/environment.rb +5 -0
  85. data/spec/dummy/config/environments/development.rb +76 -0
  86. data/spec/dummy/config/environments/production.rb +120 -0
  87. data/spec/dummy/config/environments/test.rb +59 -0
  88. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  89. data/spec/dummy/config/initializers/assets.rb +12 -0
  90. data/spec/dummy/config/initializers/backtrace_silencers.rb +8 -0
  91. data/spec/dummy/config/initializers/content_security_policy.rb +28 -0
  92. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  93. data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  94. data/spec/dummy/config/initializers/inflections.rb +16 -0
  95. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  96. data/spec/dummy/config/initializers/permissions_policy.rb +11 -0
  97. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  98. data/spec/dummy/config/locales/en.yml +33 -0
  99. data/spec/dummy/config/puma.rb +43 -0
  100. data/spec/dummy/config/routes.rb +3 -0
  101. data/spec/dummy/config/storage.yml +34 -0
  102. data/spec/dummy/config.ru +6 -0
  103. data/spec/dummy/db/development.sqlite3 +0 -0
  104. data/spec/dummy/db/test.sqlite3 +0 -0
  105. data/spec/dummy/public/404.html +67 -0
  106. data/spec/dummy/public/422.html +67 -0
  107. data/spec/dummy/public/500.html +66 -0
  108. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  109. data/spec/dummy/public/apple-touch-icon.png +0 -0
  110. data/spec/dummy/public/favicon.ico +0 -0
  111. data/spec/dummy/tmp/development_secret.txt +1 -0
  112. data/spec/helpers/govuk_design_system/accordion_helper_spec.rb +353 -0
  113. data/spec/helpers/govuk_design_system/breadcrumbs_helper_spec.rb +90 -0
  114. data/spec/helpers/govuk_design_system/button_helper_spec.rb +34 -0
  115. data/spec/helpers/govuk_design_system/checkboxes_helper_spec.rb +146 -0
  116. data/spec/helpers/govuk_design_system/cookie_banner_helper_spec.rb +65 -0
  117. data/spec/helpers/govuk_design_system/date_input_helper_spec.rb +63 -0
  118. data/spec/helpers/govuk_design_system/details_helper_spec.rb +42 -0
  119. data/spec/helpers/govuk_design_system/error_message_helper_spec.rb +18 -0
  120. data/spec/helpers/govuk_design_system/error_summary_helper_spec.rb +39 -0
  121. data/spec/helpers/govuk_design_system/header_helper_spec.rb +138 -0
  122. data/spec/helpers/govuk_design_system/hint_helper_spec.rb +20 -0
  123. data/spec/helpers/govuk_design_system/hmcts_badge_helper_spec.rb +16 -0
  124. data/spec/helpers/govuk_design_system/hmcts_banner_helper_spec.rb +59 -0
  125. data/spec/helpers/govuk_design_system/input_helper_spec.rb +157 -0
  126. data/spec/helpers/govuk_design_system/inset_text_helper_spec.rb +58 -0
  127. data/spec/helpers/govuk_design_system/label_helper_spec.rb +21 -0
  128. data/spec/helpers/govuk_design_system/notification_banner_helper_spec.rb +98 -0
  129. data/spec/helpers/govuk_design_system/radios_helper_spec.rb +270 -0
  130. data/spec/helpers/govuk_design_system/select_helper_spec.rb +85 -0
  131. data/spec/helpers/govuk_design_system/summary_list_helper_spec.rb +138 -0
  132. data/spec/helpers/govuk_design_system/tabs_helper_spec.rb +129 -0
  133. data/spec/helpers/govuk_design_system/tag_helper_spec.rb +17 -0
  134. data/spec/helpers/govuk_design_system/textarea_helper_spec.rb +67 -0
  135. data/spec/rails_helper.rb +64 -0
  136. data/spec/spec_helper.rb +116 -0
  137. metadata +401 -0
@@ -0,0 +1,43 @@
1
+ # Puma can serve each request in a thread from an internal thread pool.
2
+ # The `threads` method setting takes two numbers: a minimum and maximum.
3
+ # Any libraries that use thread pools should be configured to match
4
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
+ # and maximum; this matches the default thread size of Active Record.
6
+ #
7
+ max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8
+ min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
9
+ threads min_threads_count, max_threads_count
10
+
11
+ # Specifies the `worker_timeout` threshold that Puma will use to wait before
12
+ # terminating a worker in development environments.
13
+ #
14
+ worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
15
+
16
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
17
+ #
18
+ port ENV.fetch("PORT") { 3000 }
19
+
20
+ # Specifies the `environment` that Puma will run in.
21
+ #
22
+ environment ENV.fetch("RAILS_ENV") { "development" }
23
+
24
+ # Specifies the `pidfile` that Puma will use.
25
+ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
26
+
27
+ # Specifies the number of `workers` to boot in clustered mode.
28
+ # Workers are forked web server processes. If using threads and workers together
29
+ # the concurrency of the application would be max `threads` * `workers`.
30
+ # Workers do not work on JRuby or Windows (both of which do not support
31
+ # processes).
32
+ #
33
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
34
+
35
+ # Use the `preload_app!` method when specifying a `workers` number.
36
+ # This directive tells Puma to first boot the application and load code
37
+ # before forking the application. This takes advantage of Copy On Write
38
+ # process behavior so workers use less memory.
39
+ #
40
+ # preload_app!
41
+
42
+ # Allow puma to be restarted by `rails restart` command.
43
+ plugin :tmp_restart
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
3
+ end
@@ -0,0 +1,34 @@
1
+ test:
2
+ service: Disk
3
+ root: <%= Rails.root.join("tmp/storage") %>
4
+
5
+ local:
6
+ service: Disk
7
+ root: <%= Rails.root.join("storage") %>
8
+
9
+ # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
+ # amazon:
11
+ # service: S3
12
+ # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
+ # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
+ # region: us-east-1
15
+ # bucket: your_own_bucket
16
+
17
+ # Remember not to checkin your GCS keyfile to a repository
18
+ # google:
19
+ # service: GCS
20
+ # project: your_project
21
+ # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
+ # bucket: your_own_bucket
23
+
24
+ # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
+ # microsoft:
26
+ # service: AzureStorage
27
+ # storage_account_name: your_account_name
28
+ # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
+ # container: your_container_name
30
+
31
+ # mirror:
32
+ # service: Mirror
33
+ # primary: local
34
+ # mirrors: [ amazon, google, microsoft ]
@@ -0,0 +1,6 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require_relative "config/environment"
4
+
5
+ run Rails.application
6
+ Rails.application.load_server
File without changes
File without changes
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/404.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The page you were looking for doesn't exist.</h1>
62
+ <p>You may have mistyped the address or the page may have moved.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,67 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/422.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>The change you wanted was rejected.</h1>
62
+ <p>Maybe you tried to change something you didn't have access to.</p>
63
+ </div>
64
+ <p>If you are the application owner check the logs for more information.</p>
65
+ </div>
66
+ </body>
67
+ </html>
@@ -0,0 +1,66 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <style>
7
+ .rails-default-error-page {
8
+ background-color: #EFEFEF;
9
+ color: #2E2F30;
10
+ text-align: center;
11
+ font-family: arial, sans-serif;
12
+ margin: 0;
13
+ }
14
+
15
+ .rails-default-error-page div.dialog {
16
+ width: 95%;
17
+ max-width: 33em;
18
+ margin: 4em auto 0;
19
+ }
20
+
21
+ .rails-default-error-page div.dialog > div {
22
+ border: 1px solid #CCC;
23
+ border-right-color: #999;
24
+ border-left-color: #999;
25
+ border-bottom-color: #BBB;
26
+ border-top: #B00100 solid 4px;
27
+ border-top-left-radius: 9px;
28
+ border-top-right-radius: 9px;
29
+ background-color: white;
30
+ padding: 7px 12% 0;
31
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
32
+ }
33
+
34
+ .rails-default-error-page h1 {
35
+ font-size: 100%;
36
+ color: #730E15;
37
+ line-height: 1.5em;
38
+ }
39
+
40
+ .rails-default-error-page div.dialog > p {
41
+ margin: 0 0 1em;
42
+ padding: 1em;
43
+ background-color: #F7F7F7;
44
+ border: 1px solid #CCC;
45
+ border-right-color: #999;
46
+ border-left-color: #999;
47
+ border-bottom-color: #999;
48
+ border-bottom-left-radius: 4px;
49
+ border-bottom-right-radius: 4px;
50
+ border-top-color: #DADADA;
51
+ color: #666;
52
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
53
+ }
54
+ </style>
55
+ </head>
56
+
57
+ <body class="rails-default-error-page">
58
+ <!-- This file lives in public/500.html -->
59
+ <div class="dialog">
60
+ <div>
61
+ <h1>We're sorry, but something went wrong.</h1>
62
+ </div>
63
+ <p>If you are the application owner check the logs for more information.</p>
64
+ </div>
65
+ </body>
66
+ </html>
File without changes
File without changes
@@ -0,0 +1 @@
1
+ 902bd948b9b1b10c517333149a6d5ab4b09b5bed1de95408229e69b7a8807dc77ac9778e5abc44ba4cf218848bcbc5078bcd275c2a3d04f2f3c42d1666c64f91
@@ -0,0 +1,353 @@
1
+ require "rails_helper"
2
+
3
+ RSpec.describe GovukDesignSystem::AccordionHelper, type: :helper do
4
+ describe "#govukAccordion" do
5
+ it "returns the correct HTML for the default example" do
6
+ html = helper.govukAccordion({
7
+ id: "accordion-default",
8
+ items: [
9
+ {
10
+ heading: {
11
+ text: "Writing well for the web"
12
+ },
13
+ content: {
14
+ html: "<p class='govuk-body'>This is the content for Writing well for the web.</p>".html_safe
15
+ }
16
+ },
17
+ {
18
+ heading: {
19
+ text: "Writing well for specialists"
20
+ },
21
+ content: {
22
+ html: "<p class='govuk-body'>This is the content for Writing well for specialists.</p>".html_safe
23
+ }
24
+ },
25
+ {
26
+ heading: {
27
+ text: "Know your audience"
28
+ },
29
+ content: {
30
+ html: "<p class='govuk-body'>This is the content for Know your audience.</p>".html_safe
31
+ }
32
+ },
33
+ {
34
+ heading: {
35
+ text: "How people read"
36
+ },
37
+ content: {
38
+ html: "<p class='govuk-body'>This is the content for How people read.</p>".html_safe
39
+ }
40
+ }
41
+ ]
42
+ })
43
+
44
+ expect(html).to match_html(<<~HTML)
45
+ <div class="govuk-accordion" data-module="govuk-accordion" id="accordion-default">
46
+ <div class="govuk-accordion__section">
47
+ <div class="govuk-accordion__section-header">
48
+ <h2 class="govuk-accordion__section-heading">
49
+ <span class="govuk-accordion__section-button" id="accordion-default-heading-1">
50
+ Writing well for the web
51
+ </span>
52
+ </h2>
53
+ </div>
54
+ <div id="accordion-default-content-1" class="govuk-accordion__section-content" aria-labelledby="accordion-default-heading-1">
55
+ <p class='govuk-body'>This is the content for Writing well for the web.</p>
56
+ </div>
57
+ </div>
58
+ <div class="govuk-accordion__section">
59
+ <div class="govuk-accordion__section-header">
60
+ <h2 class="govuk-accordion__section-heading">
61
+ <span class="govuk-accordion__section-button" id="accordion-default-heading-2">
62
+ Writing well for specialists
63
+ </span>
64
+ </h2>
65
+ </div>
66
+ <div id="accordion-default-content-2" class="govuk-accordion__section-content" aria-labelledby="accordion-default-heading-2">
67
+ <p class='govuk-body'>This is the content for Writing well for specialists.</p>
68
+ </div>
69
+ </div>
70
+ <div class="govuk-accordion__section">
71
+ <div class="govuk-accordion__section-header">
72
+ <h2 class="govuk-accordion__section-heading">
73
+ <span class="govuk-accordion__section-button" id="accordion-default-heading-3">
74
+ Know your audience
75
+ </span>
76
+ </h2>
77
+ </div>
78
+ <div id="accordion-default-content-3" class="govuk-accordion__section-content" aria-labelledby="accordion-default-heading-3">
79
+ <p class='govuk-body'>This is the content for Know your audience.</p>
80
+ </div>
81
+ </div>
82
+ <div class="govuk-accordion__section">
83
+ <div class="govuk-accordion__section-header">
84
+ <h2 class="govuk-accordion__section-heading">
85
+ <span class="govuk-accordion__section-button" id="accordion-default-heading-4">
86
+ How people read
87
+ </span>
88
+ </h2>
89
+ </div>
90
+ <div id="accordion-default-content-4" class="govuk-accordion__section-content" aria-labelledby="accordion-default-heading-4">
91
+ <p class='govuk-body'>This is the content for How people read.</p>
92
+ </div>
93
+ </div>
94
+ </div>
95
+ HTML
96
+ end
97
+
98
+ it "returns the correct HTML for the summary line example" do
99
+ html = helper.govukAccordion({
100
+ id: "accordion-with-summary-sections",
101
+ items: [
102
+ {
103
+ heading: {
104
+ text: "Understanding agile project management"
105
+ },
106
+ summary: {
107
+ text: "Introductions, methods, core features."
108
+ },
109
+ content: {
110
+ html:
111
+ '<ul class="govuk-list">
112
+ <li>
113
+ <a class="govuk-link" href="#">Agile and government services: an introduction</a>
114
+ </li>
115
+ <li>
116
+ <a class="govuk-link" href="#">Agile methods: an introduction</a>
117
+ </li>
118
+ <li>
119
+ <a class="govuk-link" href="#">Core principles of agile</a>
120
+ </li>
121
+ </ul>'.html_safe
122
+ }
123
+ },
124
+ {
125
+ heading: {
126
+ text: "Working with agile methods"
127
+ },
128
+ summary: {
129
+ text: "Workspaces, tools and techniques, user stories, planning."
130
+ },
131
+ content: {
132
+ html:
133
+ '<ul class="govuk-list">
134
+ <li>
135
+ <a class="govuk-link" href="#">Creating an agile working environment</a>
136
+ </li>
137
+ <li>
138
+ <a class="govuk-link" href="#">Agile tools and techniques</a>
139
+ </li>
140
+ <li>
141
+ <a class="govuk-link" href="#">Set up a team wall</a>
142
+ </li>
143
+ <li>
144
+ <a class="govuk-link" href="#">Writing user stories</a>
145
+ </li>
146
+ <li>
147
+ <a class="govuk-link" href="#">Planning in agile</a>
148
+ </li>
149
+ <li>
150
+ <a class="govuk-link" href="#">Deciding on priorities</a>
151
+ </li>
152
+ <li>
153
+ <a class="govuk-link" href="#">Developing a roadmap</a>
154
+ </li>
155
+ </ul>'.html_safe
156
+ }
157
+ },
158
+ {
159
+ heading: {
160
+ text: "Governing agile services"
161
+ },
162
+ summary: {
163
+ text: "Principles, measuring progress, spending money."
164
+ },
165
+ content: {
166
+ html:
167
+ '<ul class="govuk-list">
168
+ <li>
169
+ <a class="govuk-link" href="#">Governance principles for agile service delivery</a>
170
+ </li>
171
+ <li>
172
+ <a class="govuk-link" href="#">Measuring and reporting progress</a>
173
+ </li>
174
+ <li>
175
+ <a class="govuk-link" href="#">Spend controls: check if you need approval to spend money on a service</a>
176
+ </li>
177
+ <li>
178
+ <a class="govuk-link" href="#">Spend controls: apply for approval to spend money on a service</a>
179
+ </li>
180
+ <li>
181
+ <a class="govuk-link" href="#">Spend controls: the new pipeline process</a>
182
+ </li>
183
+ <li>
184
+ <a class="govuk-link" href="#">Working across organisational boundaries</a>
185
+ </li>
186
+ </ul>'.html_safe
187
+ }
188
+ },
189
+ {
190
+ heading: {
191
+ text: "Phases of an agile project"
192
+ },
193
+ summary: {
194
+ text: "Discovery, alpha, beta, live and retirement."
195
+ },
196
+ content: {
197
+ html:
198
+ '<ul class="govuk-list">
199
+ <li>
200
+ <a class="govuk-link" href="#">How the discovery phase works</a>
201
+ </li>
202
+ <li>
203
+ <a class="govuk-link" href="#">How the alpha phase works</a>
204
+ </li>
205
+ <li>
206
+ <a class="govuk-link" href="#">How the beta phase works</a>
207
+ </li>
208
+ <li>
209
+ <a class="govuk-link" href="#">How the live phase works</a>
210
+ </li>
211
+ <li>
212
+ <a class="govuk-link" href="#">Retiring your service</a>
213
+ </li>
214
+ </ul>'.html_safe
215
+ }
216
+ }
217
+ ]
218
+ })
219
+
220
+ expect(html).to match_html(<<~HTML)
221
+ <div class="govuk-accordion" data-module="govuk-accordion" id="accordion-with-summary-sections">
222
+ <div class="govuk-accordion__section">
223
+ <div class="govuk-accordion__section-header">
224
+ <h2 class="govuk-accordion__section-heading">
225
+ <span class="govuk-accordion__section-button" id="accordion-with-summary-sections-heading-1">
226
+ Understanding agile project management
227
+ </span>
228
+ </h2>
229
+ <div class="govuk-accordion__section-summary govuk-body" id="accordion-with-summary-sections-summary-1">
230
+ Introductions, methods, core features.
231
+ </div>
232
+ </div>
233
+ <div id="accordion-with-summary-sections-content-1" class="govuk-accordion__section-content" aria-labelledby="accordion-with-summary-sections-heading-1">
234
+ <ul class="govuk-list">
235
+ <li>
236
+ <a class="govuk-link" href="#">Agile and government services: an introduction</a>
237
+ </li>
238
+ <li>
239
+ <a class="govuk-link" href="#">Agile methods: an introduction</a>
240
+ </li>
241
+ <li>
242
+ <a class="govuk-link" href="#">Core principles of agile</a>
243
+ </li>
244
+ </ul>
245
+ </div>
246
+ </div>
247
+ <div class="govuk-accordion__section">
248
+ <div class="govuk-accordion__section-header">
249
+ <h2 class="govuk-accordion__section-heading">
250
+ <span class="govuk-accordion__section-button" id="accordion-with-summary-sections-heading-2">
251
+ Working with agile methods
252
+ </span>
253
+ </h2>
254
+ <div class="govuk-accordion__section-summary govuk-body" id="accordion-with-summary-sections-summary-2">
255
+ Workspaces, tools and techniques, user stories, planning.
256
+ </div>
257
+ </div>
258
+ <div id="accordion-with-summary-sections-content-2" class="govuk-accordion__section-content" aria-labelledby="accordion-with-summary-sections-heading-2">
259
+ <ul class="govuk-list">
260
+ <li>
261
+ <a class="govuk-link" href="#">Creating an agile working environment</a>
262
+ </li>
263
+ <li>
264
+ <a class="govuk-link" href="#">Agile tools and techniques</a>
265
+ </li>
266
+ <li>
267
+ <a class="govuk-link" href="#">Set up a team wall</a>
268
+ </li>
269
+ <li>
270
+ <a class="govuk-link" href="#">Writing user stories</a>
271
+ </li>
272
+ <li>
273
+ <a class="govuk-link" href="#">Planning in agile</a>
274
+ </li>
275
+ <li>
276
+ <a class="govuk-link" href="#">Deciding on priorities</a>
277
+ </li>
278
+ <li>
279
+ <a class="govuk-link" href="#">Developing a roadmap</a>
280
+ </li>
281
+ </ul>
282
+ </div>
283
+ </div>
284
+ <div class="govuk-accordion__section">
285
+ <div class="govuk-accordion__section-header">
286
+ <h2 class="govuk-accordion__section-heading">
287
+ <span class="govuk-accordion__section-button" id="accordion-with-summary-sections-heading-3">
288
+ Governing agile services
289
+ </span>
290
+ </h2>
291
+ <div class="govuk-accordion__section-summary govuk-body" id="accordion-with-summary-sections-summary-3">
292
+ Principles, measuring progress, spending money.
293
+ </div>
294
+ </div>
295
+ <div id="accordion-with-summary-sections-content-3" class="govuk-accordion__section-content" aria-labelledby="accordion-with-summary-sections-heading-3">
296
+ <ul class="govuk-list">
297
+ <li>
298
+ <a class="govuk-link" href="#">Governance principles for agile service delivery</a>
299
+ </li>
300
+ <li>
301
+ <a class="govuk-link" href="#">Measuring and reporting progress</a>
302
+ </li>
303
+ <li>
304
+ <a class="govuk-link" href="#">Spend controls: check if you need approval to spend money on a service</a>
305
+ </li>
306
+ <li>
307
+ <a class="govuk-link" href="#">Spend controls: apply for approval to spend money on a service</a>
308
+ </li>
309
+ <li>
310
+ <a class="govuk-link" href="#">Spend controls: the new pipeline process</a>
311
+ </li>
312
+ <li>
313
+ <a class="govuk-link" href="#">Working across organisational boundaries</a>
314
+ </li>
315
+ </ul>
316
+ </div>
317
+ </div>
318
+ <div class="govuk-accordion__section">
319
+ <div class="govuk-accordion__section-header">
320
+ <h2 class="govuk-accordion__section-heading">
321
+ <span class="govuk-accordion__section-button" id="accordion-with-summary-sections-heading-4">
322
+ Phases of an agile project
323
+ </span>
324
+ </h2>
325
+ <div class="govuk-accordion__section-summary govuk-body" id="accordion-with-summary-sections-summary-4">
326
+ Discovery, alpha, beta, live and retirement.
327
+ </div>
328
+ </div>
329
+ <div id="accordion-with-summary-sections-content-4" class="govuk-accordion__section-content" aria-labelledby="accordion-with-summary-sections-heading-4">
330
+ <ul class="govuk-list">
331
+ <li>
332
+ <a class="govuk-link" href="#">How the discovery phase works</a>
333
+ </li>
334
+ <li>
335
+ <a class="govuk-link" href="#">How the alpha phase works</a>
336
+ </li>
337
+ <li>
338
+ <a class="govuk-link" href="#">How the beta phase works</a>
339
+ </li>
340
+ <li>
341
+ <a class="govuk-link" href="#">How the live phase works</a>
342
+ </li>
343
+ <li>
344
+ <a class="govuk-link" href="#">Retiring your service</a>
345
+ </li>
346
+ </ul>
347
+ </div>
348
+ </div>
349
+ </div>
350
+ HTML
351
+ end
352
+ end
353
+ end