Add label text to collection radio / check boxes as well

This commit is contained in:
Carlos Antonio da Silva 2012-01-27 09:36:18 -02:00
parent 51a816e904
commit 9fb217b7b0
3 changed files with 5 additions and 1 deletions

View File

@ -34,7 +34,7 @@ module SimpleForm
return unless nested_boolean_style?
proc do |label_for, text, value, html_options|
@builder.label(label_for, text) { nested_boolean_style_item_tag(value, html_options) }
@builder.label(label_for) { nested_boolean_style_item_tag(value, html_options) + text }
end
end

View File

@ -159,7 +159,9 @@ class CollectionCheckBoxesInputTest < ActionView::TestCase
with_input_for @user, :active, :check_boxes
assert_select 'label[for=user_active_true] > input#user_active_true[type=checkbox]'
assert_select 'label[for=user_active_true]', 'Yes'
assert_select 'label[for=user_active_false] > input#user_active_false[type=checkbox]'
assert_select 'label[for=user_active_false]', 'No'
assert_no_select 'label.collection_radio'
end
end

View File

@ -252,7 +252,9 @@ class CollectionRadioInputTest < ActionView::TestCase
with_input_for @user, :active, :radio
assert_select 'label[for=user_active_true] > input#user_active_true[type=radio]'
assert_select 'label[for=user_active_true]', 'Yes'
assert_select 'label[for=user_active_false] > input#user_active_false[type=radio]'
assert_select 'label[for=user_active_false]', 'No'
assert_no_select 'label.collection_radio'
end
end