Cookie banner
+
@@ -11992,11 +11676,11 @@
-
-
- Cookies on a service -
++ Cookies on a service +
A paragraph.
-A second smaller paragraph.
+A second, smaller paragraph.
render GovukComponent::CookieBanner.new(title: 'Cookies on a service') do |component|
+ render GovukComponent::CookieBanner.new(title: "Cookies on a service") do |component|
component.with(:body) do
safe_join([
tag.p("A paragraph.", class: "govuk-body"),
- tag.p("A second smaller paragraph.", class: "govuk-body-s"),
+ tag.p("A second, smaller paragraph.", class: "govuk-body-s"),
])
end
component.with(:actions) do
@@ -12351,7 +12035,7 @@ Email links
Button links (this will render a form that POSTs)
diff --git a/spec/components/govuk_component/accordion_spec.rb b/spec/components/govuk_component/accordion_spec.rb
index f3742d4f..09cca90c 100644
--- a/spec/components/govuk_component/accordion_spec.rb
+++ b/spec/components/govuk_component/accordion_spec.rb
@@ -88,6 +88,18 @@
it_behaves_like 'a component with a slot that accepts custom classes'
it_behaves_like 'a component with a slot that accepts custom html attributes'
+
+ it 'sections should have correct expanded state' do
+ render_inline(GovukComponent::Accordion.new) do |component|
+ component.slot(:section, expanded: true, title: 'section 1', html_attributes: { id: 'section_1' }) { 'abc' }
+ component.slot(:section, title: 'section 2', html_attributes: { id: 'section_2' }) { 'def' }
+ end
+ expect(page).to have_css('#section_1.govuk-accordion__section.govuk-accordion__section--expanded')
+ expect(page).to have_css('#section_2.govuk-accordion__section')
+ expect(page).not_to have_css('#section_2.govuk-accordion__section.govuk-accordion__section--expanded')
+ expect(page).to have_css('span#section-1[aria-expanded="true"]')
+ expect(page).to have_css('span#section-2[aria-expanded="false"]')
+ end
end
it_behaves_like 'a component with a DSL wrapper' do
diff --git a/spec/dummy/app/views/demos/examples/_accordion.html.erb b/spec/dummy/app/views/demos/examples/_accordion.html.erb
index ae565016..57a2ca91 100644
--- a/spec/dummy/app/views/demos/examples/_accordion.html.erb
+++ b/spec/dummy/app/views/demos/examples/_accordion.html.erb
@@ -4,7 +4,8 @@
render GovukComponent::Accordion.new(id: 'abc123') do |component|
component.slot(:section,
title: 'Home electronics',
- summary: 'Entertainment, communication and recreation') do
+ summary: 'Entertainment, communication and recreation',
+ expanded: true) do
tag.p(class: 'govuk-body') do
"Lorem ipsum dolor sit amet, consectetur adipiscing elit."
end
@@ -39,7 +40,7 @@
"Lorem ipsum dolor sit amet, consectetur adipiscing elit."
end
end
- accordion.add_section(title: 'Section 2') do
+ accordion.add_section(title: 'Section 2', expanded: true) do
tag.p(class: 'govuk-body') do
"Lorem ipsum dolor sit amet, consectetur adipiscing elit."
end