Skip to content

Commit

Permalink
resolves #442 by not merging the button_html class into the wrapper_h…
Browse files Browse the repository at this point in the history
…tml class
  • Loading branch information
justinfrench committed Nov 22, 2010
1 parent b8f1390 commit 80c11ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/formtastic.rb
Expand Up @@ -376,7 +376,7 @@ def commit_button(*args)

wrapper_html_class = ['commit', options.delete(:class)].compact # TODO: Add class reflecting on form action.
wrapper_html = options.delete(:wrapper_html) || {}
wrapper_html[:class] = (wrapper_html_class << wrapper_html[:class] << button_html[:class]).flatten.compact.join(' ')
wrapper_html[:class] = (wrapper_html_class << wrapper_html[:class]).flatten.compact.join(' ')

accesskey = (options.delete(:accesskey) || self.class.default_commit_button_accesskey) unless button_html.has_key?(:accesskey)
button_html = button_html.merge(:accesskey => accesskey) if accesskey
Expand Down
6 changes: 4 additions & 2 deletions spec/commit_button_spec.rb
Expand Up @@ -468,12 +468,14 @@ def self.human_name
it 'should merge in classes applied using the :class option' do
with_deprecation_silenced do
form = semantic_form_for(@new_post) do |builder|
concat(builder.commit_button('text', :class => 'from_button_html', :wrapper_html => {:class => 'from_wrapper_html'}))
concat(builder.commit_button('text', :class => 'from_class_option', :wrapper_html => {:class => 'from_wrapper_html'}, :button_html => { :class => 'from_button_html'}))
end
output_buffer.concat(form) if Formtastic::Util.rails3?
output_buffer.should have_tag("form li.commit")
output_buffer.should have_tag("form li.from_button_html")
output_buffer.should have_tag("form li.from_wrapper_html")
output_buffer.should have_tag("form li.from_class_option")
output_buffer.should have_tag("form li input.from_button_html")
output_buffer.should_not have_tag("form li.from_button_html")
end
end

Expand Down

0 comments on commit 80c11ae

Please sign in to comment.