Skip to content

Commit

Permalink
Fix a bug in subscription links attributes
Browse files Browse the repository at this point in the history
- only show data attributes for controls and expanded if this element is going to actually do that
- was causing an integration test in government-frontend to fail as with the attributes it wasn't rendering visibly
  • Loading branch information
andysellick committed May 15, 2018
1 parent 5bb7f20 commit aebafd0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def feed_link

def feed_link_data_attributes
data = @local_assigns[:feed_link_data_attributes] || {}
data[:controls] = feed_box_id
data[:expanded] = "false"
data[:controls] = feed_box_id if feed_link_box_value
data[:expanded] = "false" if feed_link_box_value
data
end
end
Expand Down
1 change: 1 addition & 0 deletions spec/components/subscription_links_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def component_name
it "renders a feed link" do
render_component(feed_link: 'singapore.atom')
assert_select ".gem-c-subscription-links__link--feed[href=\"singapore.atom\"]", text: "Subscribe to feed"
assert_select ".gem-c-subscription-links__link--feed[data-controls][data-expanded]", false
end

it "renders both email signup and feed links" do
Expand Down

0 comments on commit aebafd0

Please sign in to comment.