parent
67765a56d7
commit
359f481f88
|
@ -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 @@ module MiscHelpers
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue