Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use content_tag instead of button_tag for buttons #479

Merged
merged 2 commits into from Aug 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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