Test collection and item wrapper tags using the builder, and update README
This commit is contained in:
parent
4f6ed4e829
commit
227f6357f4
|
@ -89,6 +89,13 @@ SimpleForm also lets you overwrite the default input type it creates:
|
|||
|
||||
So instead of a checkbox for the :accepts attribute, you'll have a pair of radio buttons with yes/no labels and a text area instead of a text field for the description. You can also render boolean attributes using :as => :select to show a dropdown.
|
||||
|
||||
It is also possible to give the :disabled option to SimpleForm, and it'll automatically mark the wrapper as disabled with a css class, so you can style labels, hints and other components inside the wrapper as well:
|
||||
|
||||
<%= simple_form_for @user do |f| %>
|
||||
<%= f.input :username, :disabled => true, :hint => "You cannot change your username." %>
|
||||
<%= f.button :submit %>
|
||||
<% end %>
|
||||
|
||||
SimpleForm accepts same options as their corresponding input type helper in Rails:
|
||||
|
||||
<%= simple_form_for @user do |f| %>
|
||||
|
|
|
@ -538,4 +538,12 @@ class FormBuilderTest < ActionView::TestCase
|
|||
assert_select 'form input[type=checkbox][value=2][checked=checked]'
|
||||
assert_no_select 'form input[type=checkbox][value=3][checked=checked]'
|
||||
end
|
||||
|
||||
test 'builder with collection support giving collection and item wrapper tags' do
|
||||
with_association_for @user, :tags, :as => :check_boxes,
|
||||
:collection_wrapper_tag => :ul, :item_wrapper_tag => :li
|
||||
|
||||
assert_select 'form ul', :count => 1
|
||||
assert_select 'form ul li', :count => 3
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue