Move tests for proper location
This commit is contained in:
parent
8663fae306
commit
a02f805ddf
|
@ -40,6 +40,12 @@ class BuilderTest < ActionView::TestCase
|
||||||
assert_select 'form label.collection_radio[for=user_active_no]', 'No'
|
assert_select 'form label.collection_radio[for=user_active_no]', 'No'
|
||||||
end
|
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
|
test 'collection radio accepts checked item' do
|
||||||
with_collection_radio @user, :active, [[1, true], [0, false]], :last, :first, :checked => true
|
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'
|
assert_select 'form label.collection_check_boxes[for=user_active_no]', 'No'
|
||||||
end
|
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
|
test 'collection check box accepts selected values as :checked option' do
|
||||||
collection = (1..3).map{|i| [i, "Tag #{i}"] }
|
collection = (1..3).map{|i| [i, "Tag #{i}"] }
|
||||||
with_collection_check_boxes @user, :tag_ids, collection, :first, :last, :checked => [1, 3]
|
with_collection_check_boxes @user, :tag_ids, collection, :first, :last, :checked => [1, 3]
|
||||||
|
|
|
@ -368,13 +368,6 @@ class InputTest < ActionView::TestCase
|
||||||
assert_select 'label[for=user_active_false]', 'No'
|
assert_select 'label[for=user_active_false]', 'No'
|
||||||
end
|
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
|
test 'input as radio should use i18n to translate internal labels' do
|
||||||
store_translations(:en, :simple_form => { :yes => 'Sim', :no => 'Não' }) do
|
store_translations(:en, :simple_form => { :yes => 'Sim', :no => 'Não' }) do
|
||||||
with_input_for @user, :active, :radio
|
with_input_for @user, :active, :radio
|
||||||
|
|
Loading…
Reference in New Issue