Skip to content

Commit

Permalink
Merge pull request #479 from alphagov/use-content-tag-for-button
Browse files Browse the repository at this point in the history
Use content_tag instead of button_tag for buttons
  • Loading branch information
benthorner committed Aug 10, 2018
2 parents 0c4e1ca + d23d2e3 commit dc44dd6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,10 @@
useful summary for people upgrading their application, not a replication
of the commit log.

## 9.12.2

* Remove fixed 'name=button' attribute for buttons, to avoid them becoming a form param (PR #479)

## 9.12.1

* Renames the publishing-app metatag to publishing-application, to be consistent with rendering-application (PR #475)
Expand Down
Expand Up @@ -3,7 +3,7 @@
<% if button.link? %>
<%= link_to button.text, button.href, button.html_options %>
<% else %>
<%= button_tag button.text, button.html_options %>
<%= content_tag :button, button.text, button.html_options %>
<% end %>
<% if button.info_text %>
Expand Down
Expand Up @@ -24,6 +24,7 @@ def link?
def html_options
options = { class: css_classes }
options[:role] = "button" if link?
options[:type] = "submit" unless link?
options[:rel] = rel if rel
options[:data] = data_attributes if data_attributes
options[:title] = title if title
Expand Down
2 changes: 1 addition & 1 deletion lib/govuk_publishing_components/version.rb
@@ -1,3 +1,3 @@
module GovukPublishingComponents
VERSION = '9.12.1'.freeze
VERSION = '9.12.2'.freeze
end
4 changes: 2 additions & 2 deletions spec/components/button_spec.rb
Expand Up @@ -12,7 +12,7 @@ def component_name

it "renders the correct defaults" do
render_component(text: "Submit")
assert_select ".govuk-button", text: "Submit"
assert_select ".govuk-button[type=submit]", text: "Submit"
assert_select ".govuk-button--start", false
assert_select ".gem-c-button__info-text", false
end
Expand All @@ -24,7 +24,7 @@ def component_name

it "renders start now button" do
render_component(text: "Start now", href: "#", start: true)
assert_select ".govuk-button", text: "Start now", href: "#"
assert_select ".govuk-button[href='#']", text: "Start now"
assert_select ".govuk-button--start"
end

Expand Down

0 comments on commit dc44dd6

Please sign in to comment.