From f6fab5e1e4a7651de25d1c5708e438302bcba50d Mon Sep 17 00:00:00 2001 From: Andy Sellick Date: Wed, 9 May 2018 12:03:50 +0000 Subject: [PATCH] Update document list component branding - use new methods - add test --- .../components/_document_list.html.erb | 4 ++-- spec/components/document_list_spec.rb | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/views/govuk_publishing_components/components/_document_list.html.erb b/app/views/govuk_publishing_components/components/_document_list.html.erb index 5cf3d79017..8fb2d92ab2 100644 --- a/app/views/govuk_publishing_components/components/_document_list.html.erb +++ b/app/views/govuk_publishing_components/components/_document_list.html.erb @@ -7,7 +7,7 @@ brand_helper = GovukPublishingComponents::Presenters::BrandHelper.new(brand) %> <% if items.any? %> -
    +
      <% items.each do |item| %>
    1. @@ -16,7 +16,7 @@ item[:link][:text], item[:link][:path], data: item[:link][:data_attributes], - class: brand_helper.get_brand_element("color") + class: brand_helper.color_class ) %>

      diff --git a/spec/components/document_list_spec.rb b/spec/components/document_list_spec.rb index e4b85e96c9..86b9b8fe8a 100644 --- a/spec/components/document_list_spec.rb +++ b/spec/components/document_list_spec.rb @@ -131,4 +131,25 @@ def component_name assert_select "#{li} a[data-track-label='/link2']", text: "Link 2" assert_select "#{li} a[data-track-options='{\"dimension28\":\"2\",\"dimension29\":\"Link 2\"}']", text: "Link 2" end + + it "adds branding correctly" do + render_component( + brand: 'attorney-generals-office', + items: [ + { + link: { + text: "School behaviour and attendance: parental responsibility measures", + path: "/government/publications/parental-responsibility-measures-for-behaviour-and-attendance", + }, + metadata: { + public_updated_at: Time.zone.parse("2017-01-05 14:50:33 +0000"), + document_type: "Statutory guidance" + } + } + ] + ) + + assert_select '.gem-c-document-list.brand--attorney-generals-office' + assert_select '.gem-c-document-list .gem-c-document-list__item-title .brand__color' + end end