From 0a492c5aee5c615136d37ea923648aad01ecbbae Mon Sep 17 00:00:00 2001 From: Peter Yates Date: Sun, 8 Sep 2024 19:02:43 +0100 Subject: [PATCH] Fix typo in govuk-width-container class name Also bump the version as this will need a release and add some tests covering the forgotten width container --- .../service_navigation_component.rb | 2 +- lib/govuk/components/version.rb | 2 +- .../service_navigation_component_spec.rb | 44 +++++++++++-------- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/app/components/govuk_component/service_navigation_component.rb b/app/components/govuk_component/service_navigation_component.rb index 3344375d..9bc82c80 100644 --- a/app/components/govuk_component/service_navigation_component.rb +++ b/app/components/govuk_component/service_navigation_component.rb @@ -36,7 +36,7 @@ def initialize(service_name: nil, service_url: nil, navigation_items: [], curren def call outer_element do - tag.div(class: "#{brand}-width_container") do + tag.div(class: "#{brand}-width-container") do safe_join( [ start_slot, diff --git a/lib/govuk/components/version.rb b/lib/govuk/components/version.rb index 821481cb..49d1de17 100644 --- a/lib/govuk/components/version.rb +++ b/lib/govuk/components/version.rb @@ -1,5 +1,5 @@ module Govuk module Components - VERSION = '5.6.0'.freeze + VERSION = '5.6.1'.freeze end end diff --git a/spec/components/govuk_component/service_navigation_component_spec.rb b/spec/components/govuk_component/service_navigation_component_spec.rb index 2955035f..979934ff 100644 --- a/spec/components/govuk_component/service_navigation_component_spec.rb +++ b/spec/components/govuk_component/service_navigation_component_spec.rb @@ -34,9 +34,11 @@ specify 'contains the service name in a span' do expect(rendered_content).to have_tag("section", with: { class: component_css_class }) do - with_tag('div', with: { class: 'govuk-service-navigation__container' }) do - with_tag('span', class: 'govuk-service-navigation__service-name') do - with_tag('span', text: service_name, with: { class: 'govuk-service-navigation__text' }) + with_tag('div', with: { class: 'govuk-width-container' }) do + with_tag('div', with: { class: 'govuk-service-navigation__container' }) do + with_tag('span', class: 'govuk-service-navigation__service-name') do + with_tag('span', text: service_name, with: { class: 'govuk-service-navigation__text' }) + end end end end @@ -47,9 +49,11 @@ specify 'contains a hyperlink with the service name and url' do expect(rendered_content).to have_tag("section", with: { class: component_css_class }) do - with_tag('div', with: { class: 'govuk-service-navigation__container' }) do - with_tag('span', class: 'govuk-service-navigation__service-name') do - with_tag('a', text: service_name, with: { href: service_url, class: 'govuk-service-navigation__link' }) + with_tag('div', with: { class: 'govuk-width-container' }) do + with_tag('div', with: { class: 'govuk-service-navigation__container' }) do + with_tag('span', class: 'govuk-service-navigation__service-name') do + with_tag('a', text: service_name, with: { href: service_url, class: 'govuk-service-navigation__link' }) + end end end end @@ -67,11 +71,13 @@ specify 'the items are rendered in a list' do expect(rendered_content).to have_tag("div", with: { class: component_css_class }) do - with_tag('div', with: { class: 'govuk-service-navigation__container' }) do - with_tag('ul', with: { class: 'govuk-service-navigation__list' }) do - navigation_items.each do |ni| - with_tag('li', with: { class: 'govuk-service-navigation__item' }) do - with_tag('a', text: ni.fetch(:text), with: { href: ni.fetch(:href) }) + with_tag('div', with: { class: 'govuk-width-container' }) do + with_tag('div', with: { class: 'govuk-service-navigation__container' }) do + with_tag('ul', with: { class: 'govuk-service-navigation__list' }) do + navigation_items.each do |ni| + with_tag('li', with: { class: 'govuk-service-navigation__item' }) do + with_tag('a', text: ni.fetch(:text), with: { href: ni.fetch(:href) }) + end end end end @@ -95,13 +101,15 @@ specify 'the menu button is present' do expect(rendered_content).to have_tag("div", with: { class: component_css_class }) do - with_tag('div', with: { class: 'govuk-service-navigation__container' }) do - with_tag('button', with: { - type: 'button', - class: %w(govuk-service-navigation__toggle govuk-js-service-navigation-toggle), - hidden: 'hidden', - 'aria-controls' => 'navigation' - }) + with_tag('div', with: { class: 'govuk-width-container' }) do + with_tag('div', with: { class: 'govuk-service-navigation__container' }) do + with_tag('button', with: { + type: 'button', + class: %w(govuk-service-navigation__toggle govuk-js-service-navigation-toggle), + hidden: 'hidden', + 'aria-controls' => 'navigation' + }) + end end end end