diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 4538b6d..b9420d0 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -447,6 +447,40 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal expected, _erbout end + def test_nested_fields_for_with_nested_collections + _erbout = '' + form_for('post[]', @post) do |f| + _erbout.concat f.text_field(:title) + f.fields_for('comment[]', @comment) do |c| + _erbout.concat c.text_field(:name) + end + end + + expected = "
" + + "" + + "" + + "
" + + assert_dom_equal expected, _erbout + end + + def test_nested_fields_for_with_index + _erbout = '' + form_for('post', @post, :index => 1) do |c| + _erbout.concat c.text_field(:title) + c.fields_for('comment', @comment, :index => 1) do |r| + _erbout.concat r.text_field(:name) + end + end + + expected = "
" + + "" + + "" + + "
" + + assert_dom_equal expected, _erbout + end + def test_fields_for _erbout = ''