1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00

Move tests for proper location

This commit is contained in:
Rafael Mendonça França 2010-10-28 06:24:25 +08:00 committed by José Valim
parent 8663fae306
commit a02f805ddf
2 changed files with 12 additions and 7 deletions

View file

@ -40,6 +40,12 @@ class BuilderTest < ActionView::TestCase
assert_select 'form label.collection_radio[for=user_active_no]', 'No'
end
test 'colection radio should sanitize collection values for labels correctly' do
with_collection_radio @user, :name, ['$0.99', '$1.99'], :to_s, :to_s
assert_select 'label.collection_radio[for=user_name_099]', '$0.99'
assert_select 'label.collection_radio[for=user_name_199]', '$1.99'
end
test 'collection radio accepts checked item' do
with_collection_radio @user, :active, [[1, true], [0, false]], :last, :first, :checked => true
@ -96,6 +102,12 @@ class BuilderTest < ActionView::TestCase
assert_select 'form label.collection_check_boxes[for=user_active_no]', 'No'
end
test 'colection check box should sanitize collection values for labels correctly' do
with_collection_check_boxes @user, :name, ['$0.99', '$1.99'], :to_s, :to_s
assert_select 'label.collection_check_boxes[for=user_name_099]', '$0.99'
assert_select 'label.collection_check_boxes[for=user_name_199]', '$1.99'
end
test 'collection check box accepts selected values as :checked option' do
collection = (1..3).map{|i| [i, "Tag #{i}"] }
with_collection_check_boxes @user, :tag_ids, collection, :first, :last, :checked => [1, 3]

View file

@ -368,13 +368,6 @@ class InputTest < ActionView::TestCase
assert_select 'label[for=user_active_false]', 'No'
end
test 'input as radio should sanitize the label for attribute' do
with_input_for @user, :name, :radio, :collection => ['$0.99', '$1.99']
assert_select 'label.collection_radio[for=user_name_099]', '$0.99'
assert_select 'label.collection_radio[for=user_name_199]', '$1.99'
end
test 'input as radio should use i18n to translate internal labels' do
store_translations(:en, :simple_form => { :yes => 'Sim', :no => 'Não' }) do
with_input_for @user, :active, :radio