diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-02-01 19:16:58 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-02-02 14:52:15 -0200 |
commit | f506c8063b3084f54aa8bd157d94f10b7aed2bf0 (patch) | |
tree | 199ca69d058f111e402ee57821e47cd4030ab8d0 /actionpack/test | |
parent | 9035324367526af0300477a58b6d3efc15d1a5a8 (diff) | |
download | rails-f506c8063b3084f54aa8bd157d94f10b7aed2bf0.tar.gz rails-f506c8063b3084f54aa8bd157d94f10b7aed2bf0.tar.bz2 rails-f506c8063b3084f54aa8bd157d94f10b7aed2bf0.zip |
Add changelog, docs and guides entries
[Carlos Antonio da Silva + Rafael Mendonça França]
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/form_collections_helper_test.rb | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/actionpack/test/template/form_collections_helper_test.rb b/actionpack/test/template/form_collections_helper_test.rb index 926be24044..3839aa2a00 100644 --- a/actionpack/test/template/form_collections_helper_test.rb +++ b/actionpack/test/template/form_collections_helper_test.rb @@ -83,7 +83,7 @@ class FormCollectionsHelperTest < ActionView::TestCase assert_no_select 'label input' end - test 'collection radio accepts a block to render the radio and label as required' do + test 'collection radio accepts a block to render the label as radio button wrapper' do with_collection_radio_buttons :user, :active, [true, false], :to_s, :to_s do |b| b.label { b.radio_button } end @@ -92,6 +92,15 @@ class FormCollectionsHelperTest < ActionView::TestCase assert_select 'label[for=user_active_false] > input#user_active_false[type=radio]' end + test 'collection radio accepts a block to change the order of label and radio button' do + with_collection_radio_buttons :user, :active, [true, false], :to_s, :to_s do |b| + b.label + b.radio_button + end + + assert_select 'label[for=user_active_true] + input#user_active_true[type=radio]' + assert_select 'label[for=user_active_false] + input#user_active_false[type=radio]' + end + test 'collection radio buttons with fields for' do collection = [Category.new(1, 'Category 1'), Category.new(2, 'Category 2')] @output_buffer = fields_for(:post) do |p| @@ -228,7 +237,7 @@ class FormCollectionsHelperTest < ActionView::TestCase assert_no_select 'label input' end - test 'collection check boxes accepts a block to render the radio and label as required' do + test 'collection check boxes accepts a block to render the label as check box wrapper' do with_collection_check_boxes :user, :active, [true, false], :to_s, :to_s do |b| b.label { b.check_box } end @@ -236,4 +245,13 @@ class FormCollectionsHelperTest < ActionView::TestCase assert_select 'label[for=user_active_true] > input#user_active_true[type=checkbox]' assert_select 'label[for=user_active_false] > input#user_active_false[type=checkbox]' end + + test 'collection check boxes accepts a block to change the order of label and check box' do + with_collection_check_boxes :user, :active, [true, false], :to_s, :to_s do |b| + b.label + b.check_box + end + + assert_select 'label[for=user_active_true] + input#user_active_true[type=checkbox]' + assert_select 'label[for=user_active_false] + input#user_active_false[type=checkbox]' + end end |