Skip to content

Commit

Permalink
Add failing case for html options duplicated
Browse files Browse the repository at this point in the history
Closes #488.
  • Loading branch information
rafaelfranca committed Apr 21, 2012
1 parent 67765a5 commit 359f481
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
Closes [#553](https://github.com/plataformatec/simple_form/issues/533).
([@nashby](https://github.com/nashby))
* Fix limit and maxlength with decimal points. ([@shwoodard](https://github.com/shwoodard))
* Fix issue when html are duplicated.
Closes [#488](https://github.com/plataformatec/simple_form/issues/488).
([@ebonical](https://github.com/ebonical))

## 2.0.1

Expand Down
13 changes: 13 additions & 0 deletions test/form_builder/wrapper_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,19 @@ class WrapperTest < ActionView::TestCase
end
end

test 'access wrappers with indfferent access' do
swap_wrapper :default, self.custom_wrapper_with_label_html_option do
with_concat_form_for(@user) do |f|
concat f.input :name, :required => false
concat f.input :email, :as => :email, :required => true
end

assert_select "label.string.optional.extra-label-class[for='user_name']"
assert_select "label.email.required.extra-label-class[for='user_email']"
assert_no_select "label.string.optional.extra-label-class[for='user_email']"
end
end

test 'raise error when wrapper not found' do
assert_raise SimpleForm::WrapperNotFound do
with_form_for @user, :name, :wrapper => :not_found
Expand Down
7 changes: 7 additions & 0 deletions test/support/misc_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ def custom_wrapper_without_top_level
end
end

def custom_wrapper_with_label_html_option
SimpleForm.build :tag => :div, :class => "custom_wrapper", :label_html => {:class => 'extra-label-class'} do |b|
b.use :label_input
end
end


def custom_form_for(object, *args, &block)
simple_form_for(object, *(args << { :builder => CustomFormBuilder }), &block)
end
Expand Down

0 comments on commit 359f481

Please sign in to comment.