diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2012-08-08 16:35:59 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2012-08-08 16:36:46 -0500 |
commit | b540f4c1b812453d680724527635eddbffb980c4 (patch) | |
tree | 495e3c1465a476e39d7ed9799f066f02177958e1 /actionpack/test | |
parent | c0954a4802028976d59f3fec645c5784e1572e82 (diff) | |
download | rails-b540f4c1b812453d680724527635eddbffb980c4.tar.gz rails-b540f4c1b812453d680724527635eddbffb980c4.tar.bz2 rails-b540f4c1b812453d680724527635eddbffb980c4.zip |
Allow data attributes to be set as a first-level option for form_for, so you can write `form_for @record, data: { behavior: 'autosave' }` instead of `form_for @record, html: { data: { behavior: 'autosave' } }` *DHH*
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index a20a68c1b2..152b35ff0f 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -2637,6 +2637,12 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal expected, output_buffer end + def test_form_for_with_data_attributes + form_for(@post, data: { behavior: "stuff" }, remote: true) {} + assert_match %r|data-behavior="stuff"|, output_buffer + assert_match %r|data-remote="true"|, output_buffer + end + def test_fields_for_returns_block_result output = fields_for(Post.new) { |f| "fields" } assert_equal "fields", output |