Permalink
Browse files

Add failing case for html options duplicated

Closes #488.
  • Loading branch information...
1 parent 67765a5 commit 359f481f882d8b65aa2c196d5a708395bc5e2f5d @rafaelfranca rafaelfranca committed Apr 21, 2012
Showing with 23 additions and 0 deletions.
  1. +3 −0 CHANGELOG.md
  2. +13 −0 test/form_builder/wrapper_test.rb
  3. +7 −0 test/support/misc_helpers.rb
View
@@ -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
@@ -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
@@ -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

0 comments on commit 359f481

Please sign in to comment.