Skip to content

Commit

Permalink
Update document list component branding
Browse files Browse the repository at this point in the history
- use new methods
- add test
  • Loading branch information
andysellick committed May 9, 2018
1 parent c06106e commit f6fab5e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
brand_helper = GovukPublishingComponents::Presenters::BrandHelper.new(brand)
%>
<% if items.any? %>
<ol class="gem-c-document-list<%= margin_bottom_class %><%= margin_top_class %> <%= brand_helper.get_brand %>">
<ol class="gem-c-document-list<%= margin_bottom_class %><%= margin_top_class %> <%= brand_helper.brand_class %>">
<% items.each do |item| %>
<li class="gem-c-document-list__item">
<h3 class="gem-c-document-list__item-title">
Expand All @@ -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
)
%>
</h3>
Expand Down
21 changes: 21 additions & 0 deletions spec/components/document_list_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit f6fab5e

Please sign in to comment.