|
|
|
@ -314,11 +314,11 @@ def test_form_with
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", "create-post", method: "patch") do
|
|
|
|
|
"<label for='post_title'>The Title</label>" \
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' id='post_title' />" \
|
|
|
|
|
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' />" \
|
|
|
|
|
"<select name='post[category]'><option value='animal'>animal</option>\n<option value='economy'>economy</option>\n<option value='sports'>sports</option></select>" \
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' />" \
|
|
|
|
|
"<select name='post[category]' id='post_category'><option value='animal'>animal</option>\n<option value='economy'>economy</option>\n<option value='sports'>sports</option></select>" \
|
|
|
|
|
"<input name='commit' data-disable-with='Create post' type='submit' value='Create post' />" \
|
|
|
|
|
"<button name='button' type='submit'>Create post</button>" \
|
|
|
|
|
"<button name='button' type='submit'><span>Create post</span></button>"
|
|
|
|
@ -327,6 +327,34 @@ def test_form_with
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def test_form_with_not_outputting_ids
|
|
|
|
|
old_value = ActionView::Helpers::FormHelper.form_with_generates_ids
|
|
|
|
|
ActionView::Helpers::FormHelper.form_with_generates_ids = false
|
|
|
|
|
|
|
|
|
|
form_with(model: @post, id: "create-post") do |f|
|
|
|
|
|
concat f.label(:title) { "The Title" }
|
|
|
|
|
concat f.text_field(:title)
|
|
|
|
|
concat f.text_area(:body)
|
|
|
|
|
concat f.check_box(:secret)
|
|
|
|
|
concat f.select(:category, %w( animal economy sports ))
|
|
|
|
|
concat f.submit("Create post")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", "create-post", method: "patch") do
|
|
|
|
|
"<label>The Title</label>" \
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' />" \
|
|
|
|
|
"<select name='post[category]'><option value='animal'>animal</option>\n<option value='economy'>economy</option>\n<option value='sports'>sports</option></select>" \
|
|
|
|
|
"<input name='commit' data-disable-with='Create post' type='submit' value='Create post' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
|
ensure
|
|
|
|
|
ActionView::Helpers::FormHelper.form_with_generates_ids = old_value
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def test_form_with_only_url_on_create
|
|
|
|
|
form_with(url: "/posts") do |f|
|
|
|
|
|
concat f.label :title, "Label me"
|
|
|
|
@ -335,7 +363,7 @@ def test_form_with_only_url_on_create
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts") do
|
|
|
|
|
'<label for="title">Label me</label>' \
|
|
|
|
|
'<input type="text" name="title">'
|
|
|
|
|
'<input type="text" name="title" id="title">'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -349,7 +377,7 @@ def test_form_with_only_url_on_update
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123") do
|
|
|
|
|
'<label for="title">Label me</label>' \
|
|
|
|
|
'<input type="text" name="title">'
|
|
|
|
|
'<input type="text" name="title" id="title">'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -361,7 +389,7 @@ def test_form_with_general_attributes
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123") do
|
|
|
|
|
'<input type="text" name="no_model_to_back_this_badboy">'
|
|
|
|
|
'<input type="text" name="no_model_to_back_this_badboy" id="no_model_to_back_this_badboy" >'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -373,7 +401,7 @@ def test_form_with_attribute_not_on_model
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: :patch) do
|
|
|
|
|
'<input type="text" name="post[this_dont_exist_on_post]">'
|
|
|
|
|
'<input type="text" name="post[this_dont_exist_on_post]" id="post_this_dont_exist_on_post" >'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -391,8 +419,8 @@ def test_form_with_doesnt_call_private_or_protected_properties_on_form_object_sk
|
|
|
|
|
end.new
|
|
|
|
|
|
|
|
|
|
form_with(model: obj, scope: "other_name", url: "/", id: "edit-other-name") do |f|
|
|
|
|
|
assert_dom_equal '<input type="hidden" name="other_name[private_property]">', f.hidden_field(:private_property)
|
|
|
|
|
assert_dom_equal '<input type="hidden" name="other_name[protected_property]">', f.hidden_field(:protected_property)
|
|
|
|
|
assert_dom_equal '<input type="hidden" name="other_name[private_property]" id="other_name_private_property">', f.hidden_field(:private_property)
|
|
|
|
|
assert_dom_equal '<input type="hidden" name="other_name[protected_property]" id="other_name_protected_property">', f.hidden_field(:protected_property)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -459,7 +487,7 @@ def post.id; 1; end
|
|
|
|
|
"<label for='post_active_false'>" \
|
|
|
|
|
"<input checked='checked' name='post[active]' type='radio' value='false' id='post_active_false' />" \
|
|
|
|
|
"false</label>" \
|
|
|
|
|
"<input name='post[id]' type='hidden' value='1' />"
|
|
|
|
|
"<input name='post[id]' type='hidden' value='1' id='post_id' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -557,7 +585,7 @@ def post.id; 1; end
|
|
|
|
|
"<label for='post_tag_ids_3'>" \
|
|
|
|
|
"<input checked='checked' name='post[tag_ids][]' type='checkbox' value='3' id='post_tag_ids_3' />" \
|
|
|
|
|
"Tag 3</label>" \
|
|
|
|
|
"<input name='post[id]' type='hidden' value='1' />"
|
|
|
|
|
"<input name='post[id]' type='hidden' value='1' id='post_id' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -587,7 +615,7 @@ def test_form_with_with_file_field_generate_multipart
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", "create-post", method: "patch", multipart: true) do
|
|
|
|
|
"<input name='post[file]' type='file' />"
|
|
|
|
|
"<input name='post[file]' type='file' id='post_file' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -601,7 +629,7 @@ def test_fields_with_file_field_generate_multipart
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch", multipart: true) do
|
|
|
|
|
"<input name='post[comment][file]' type='file' />"
|
|
|
|
|
"<input name='post[comment][file]' type='file' id='post_comment_file'/>"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -640,7 +668,7 @@ def test_form_with_with_model_using_relative_model_naming
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/44", method: "patch") do
|
|
|
|
|
"<input name='post[title]' type='text' value='And his name will be forty and four.' />" \
|
|
|
|
|
"<input name='post[title]' type='text' value='And his name will be forty and four.' id='post_title' />" \
|
|
|
|
|
"<input name='commit' data-disable-with='Edit post' type='submit' value='Edit post' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -658,10 +686,10 @@ def test_form_with_with_symbol_scope
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", "create-post", method: "patch") do
|
|
|
|
|
"<label for='other_name_title' class='post_title'>Title</label>" \
|
|
|
|
|
"<input name='other_name[title]' value='Hello World' type='text' />" \
|
|
|
|
|
"<textarea name='other_name[body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='other_name[title]' value='Hello World' type='text' id='other_name_title' />" \
|
|
|
|
|
"<textarea name='other_name[body]' id='other_name_body'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='other_name[secret]' value='0' type='hidden' />" \
|
|
|
|
|
"<input name='other_name[secret]' checked='checked' value='1' type='checkbox' />" \
|
|
|
|
|
"<input name='other_name[secret]' checked='checked' value='1' type='checkbox' id='other_name_secret' />" \
|
|
|
|
|
"<input name='commit' value='Create post' data-disable-with='Create post' type='submit' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -676,10 +704,10 @@ def test_form_with_with_method_as_part_of_html_options
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/", "create-post", method: "delete") do
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' id='post_title' />" \
|
|
|
|
|
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' />"
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret'/>"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -693,10 +721,10 @@ def test_form_with_with_method
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/", "create-post", method: "delete") do
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' id='post_title' />" \
|
|
|
|
|
"<textarea name='post[body]' id='post_body' >\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' />"
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -710,7 +738,7 @@ def test_form_with_with_search_field
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/search", "search-post", method: "get") do
|
|
|
|
|
"<input name='post[title]' type='search' />"
|
|
|
|
|
"<input name='post[title]' type='search' id='post_title' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -724,10 +752,10 @@ def test_form_with_enables_remote_by_default
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/", "create-post", method: "patch") do
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' id='post_title' />" \
|
|
|
|
|
"<textarea name='post[body]' id='post_body' >\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' />"
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -744,10 +772,10 @@ def test_form_is_not_remote_by_default_if_form_with_generates_remote_forms_is_fa
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/", "create-post", method: "patch", local: true) do
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' id='post_title' />" \
|
|
|
|
|
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' />"
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -761,7 +789,7 @@ def test_form_with_skip_enforcing_utf8_true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/", skip_enforcing_utf8: true) do
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' />"
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' id='post_title' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -773,7 +801,7 @@ def test_form_with_skip_enforcing_utf8_false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/", skip_enforcing_utf8: false) do
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' />"
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' id='post_title' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -787,10 +815,10 @@ def test_form_with_without_object
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/", "create-post") do
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' id='post_title' />" \
|
|
|
|
|
"<textarea name='post[body]' id='post_body' >\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' />"
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -806,10 +834,10 @@ def test_form_with_with_index
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<label for='post_123_title'>Title</label>" \
|
|
|
|
|
"<input name='post[123][title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[123][body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[123][title]' type='text' value='Hello World' id='post_123_title' />" \
|
|
|
|
|
"<textarea name='post[123][body]' id='post_123_body'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[123][secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='post[123][secret]' checked='checked' type='checkbox' value='1' />"
|
|
|
|
|
"<input name='post[123][secret]' checked='checked' type='checkbox' value='1' id='post_123_secret' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -823,10 +851,10 @@ def test_form_with_with_nil_index_option_override
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<input name='post[][title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[][body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[][title]' type='text' value='Hello World' id='post__title' />" \
|
|
|
|
|
"<textarea name='post[][body]' id='post__body' >\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[][secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='post[][secret]' checked='checked' type='checkbox' value='1' />"
|
|
|
|
|
"<input name='post[][secret]' checked='checked' type='checkbox' value='1' id='post__secret' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -841,7 +869,7 @@ def test_form_with_label_error_wrapping
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<div class='field_with_errors'><label for='post_author_name' class='label'>Author name</label></div>" \
|
|
|
|
|
"<div class='field_with_errors'><input name='post[author_name]' type='text' value='' /></div>" \
|
|
|
|
|
"<div class='field_with_errors'><input name='post[author_name]' type='text' value='' id='post_author_name' /></div>" \
|
|
|
|
|
"<input name='commit' data-disable-with='Create post' type='submit' value='Create post' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -859,7 +887,7 @@ def test_form_with_label_error_wrapping_without_conventional_instance_variable
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<div class='field_with_errors'><label for='post_author_name' class='label'>Author name</label></div>" \
|
|
|
|
|
"<div class='field_with_errors'><input name='post[author_name]' type='text' value='' /></div>" \
|
|
|
|
|
"<div class='field_with_errors'><input name='post[author_name]' type='text' value='' id='post_author_name' /></div>" \
|
|
|
|
|
"<input name='commit' data-disable-with='Create post' type='submit' value='Create post' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -947,7 +975,7 @@ def test_fields_with_attributes_not_on_model
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: :patch) do
|
|
|
|
|
'<input type="text" name="post[comment][dont_exist_on_model]">'
|
|
|
|
|
'<input type="text" name="post[comment][dont_exist_on_model]" id="post_comment_dont_exist_on_model" >'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -967,7 +995,7 @@ def test_fields_with_attributes_not_on_model_deep_nested
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form do
|
|
|
|
|
'<input name="posts[post][0][comment][1][dont_exist_on_model]" type="text">'
|
|
|
|
|
'<input name="posts[post][0][comment][1][dont_exist_on_model]" type="text" id="posts_post_0_comment_1_dont_exist_on_model" >'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -982,7 +1010,7 @@ def test_nested_fields
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<input name='post[comment][body]' type='text' value='Hello World' />"
|
|
|
|
|
"<input name='post[comment][body]' type='text' value='Hello World' id='post_comment_body' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1002,7 +1030,7 @@ def test_deep_nested_fields
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form do
|
|
|
|
|
"<input name='posts[post][0][comment][1][name]' type='text' value='comment #1' />"
|
|
|
|
|
"<input name='posts[post][0][comment][1][name]' type='text' value='comment #1' id='posts_post_0_comment_1_name' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1017,8 +1045,8 @@ def test_nested_fields_with_nested_collections
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<input name='post[123][title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<input name='post[123][comment][][name]' type='text' value='new comment' />"
|
|
|
|
|
"<input name='post[123][title]' type='text' value='Hello World' id='post_123_title' />" \
|
|
|
|
|
"<input name='post[123][comment][][name]' type='text' value='new comment' id='post_123_comment__name' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1033,8 +1061,8 @@ def test_nested_fields_with_index_and_parent_fields
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<input name='post[1][title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<input name='post[1][comment][1][name]' type='text' value='new comment' />"
|
|
|
|
|
"<input name='post[1][title]' type='text' value='Hello World' id='post_1_title' />" \
|
|
|
|
|
"<input name='post[1][comment][1][name]' type='text' value='new comment' id='post_1_comment_1_name' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1048,7 +1076,7 @@ def test_form_with_with_index_and_nested_fields
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<input name='post[1][comment][title]' type='text' value='Hello World' />"
|
|
|
|
|
"<input name='post[1][comment][title]' type='text' value='Hello World' id='post_1_comment_title' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1062,7 +1090,7 @@ def test_nested_fields_with_index_on_both
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<input name='post[1][comment][5][title]' type='text' value='Hello World' />"
|
|
|
|
|
"<input name='post[1][comment][5][title]' type='text' value='Hello World' id='post_1_comment_5_title' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1076,7 +1104,7 @@ def test_nested_fields_with_auto_index
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<input name='post[123][comment][title]' type='text' value='Hello World' />"
|
|
|
|
|
"<input name='post[123][comment][title]' type='text' value='Hello World' id='post_123_comment_title' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1090,7 +1118,7 @@ def test_nested_fields_with_index_radio_button
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<input name='post[comment][5][title]' type='radio' value='hello' />"
|
|
|
|
|
"<input name='post[comment][5][title]' type='radio' value='hello' id='post_comment_5_title_hello' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1104,7 +1132,7 @@ def test_nested_fields_with_auto_index_on_both
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<input name='post[123][comment][123][title]' type='text' value='Hello World' />"
|
|
|
|
|
"<input name='post[123][comment][123][title]' type='text' value='Hello World' id='post_123_comment_123_title' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1124,9 +1152,9 @@ def test_nested_fields_with_index_and_auto_index
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<input name='post[123][comment][5][title]' type='text' value='Hello World' />"
|
|
|
|
|
"<input name='post[123][comment][5][title]' type='text' value='Hello World' id='post_123_comment_5_title' />"
|
|
|
|
|
end + whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<input name='post[1][comment][123][title]' type='text' value='Hello World' />"
|
|
|
|
|
"<input name='post[1][comment][123][title]' type='text' value='Hello World' id='post_1_comment_123_title' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1143,8 +1171,8 @@ def test_nested_fields_with_a_new_record_on_a_nested_attributes_one_to_one_assoc
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="new author" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="new author" id="post_author_attributes_name" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1170,9 +1198,9 @@ def test_nested_fields_with_an_existing_record_on_a_nested_attributes_one_to_one
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" />' \
|
|
|
|
|
'<input name="post[author_attributes][id]" type="hidden" value="321" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" id="post_author_attributes_name" />' \
|
|
|
|
|
'<input name="post[author_attributes][id]" type="hidden" value="321" id="post_author_attributes_id" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1189,9 +1217,9 @@ def test_nested_fields_with_an_existing_record_on_a_nested_attributes_one_to_one
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" />' \
|
|
|
|
|
'<input name="post[author_attributes][id]" type="hidden" value="321" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" id="post_author_attributes_name" />' \
|
|
|
|
|
'<input name="post[author_attributes][id]" type="hidden" value="321" id="post_author_attributes_id" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1208,8 +1236,8 @@ def test_nested_fields_with_an_existing_record_on_a_nested_attributes_one_to_one
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" id="post_author_attributes_name" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1226,8 +1254,8 @@ def test_nested_fields_with_an_existing_record_on_a_nested_attributes_one_to_one
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" id="post_author_attributes_name" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1244,9 +1272,9 @@ def test_nested_fields_with_an_existing_record_on_a_nested_attributes_one_to_one
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" />' \
|
|
|
|
|
'<input name="post[author_attributes][id]" type="hidden" value="321" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" id="post_author_attributes_name" />' \
|
|
|
|
|
'<input name="post[author_attributes][id]" type="hidden" value="321" id="post_author_attributes_id" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1264,9 +1292,9 @@ def test_nested_fields_with_existing_records_on_a_nested_attributes_one_to_one_a
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[author_attributes][id]" type="hidden" value="321" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[author_attributes][id]" type="hidden" value="321" id="post_author_attributes_id" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" id="post_author_attributes_name" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1285,11 +1313,11 @@ def test_nested_fields_with_existing_records_on_a_nested_attributes_collection_a
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="1" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][id]" type="hidden" value="2" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" id="post_comments_attributes_0_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="1" id="post_comments_attributes_0_id" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" id="post_comments_attributes_1_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][id]" type="hidden" value="2" id="post_comments_attributes_1_id" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1312,11 +1340,11 @@ def test_nested_fields_with_existing_records_on_a_nested_attributes_collection_a
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" />' \
|
|
|
|
|
'<input name="post[author_attributes][id]" type="hidden" value="321" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" id="post_author_attributes_name" />' \
|
|
|
|
|
'<input name="post[author_attributes][id]" type="hidden" value="321" id="post_author_attributes_id" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" id="post_comments_attributes_0_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" id="post_comments_attributes_1_name" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1339,10 +1367,10 @@ def test_nested_fields_with_existing_records_on_a_nested_attributes_collection_a
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" id="post_author_attributes_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" id="post_comments_attributes_0_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" id="post_comments_attributes_1_name" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1365,11 +1393,11 @@ def test_nested_fields_with_existing_records_on_a_nested_attributes_collection_a
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" />' \
|
|
|
|
|
'<input name="post[author_attributes][id]" type="hidden" value="321" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="author #321" id="post_author_attributes_name" />' \
|
|
|
|
|
'<input name="post[author_attributes][id]" type="hidden" value="321" id="post_author_attributes_id" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" id="post_comments_attributes_0_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" id="post_comments_attributes_1_name" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1388,11 +1416,11 @@ def test_nested_fields_with_existing_records_on_a_nested_attributes_collection_a
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="1" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][id]" type="hidden" value="2" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" id="post_comments_attributes_0_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="1" id="post_comments_attributes_0_id" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" id="post_comments_attributes_1_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][id]" type="hidden" value="2" id="post_comments_attributes_1_id" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1412,11 +1440,11 @@ def test_nested_fields_with_existing_records_on_a_nested_attributes_collection_a
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="1" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][id]" type="hidden" value="2" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="1" id="post_comments_attributes_0_id" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" id="post_comments_attributes_0_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][id]" type="hidden" value="2" id="post_comments_attributes_1_id" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" id="post_comments_attributes_1_name" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1435,9 +1463,9 @@ def test_nested_fields_with_new_records_on_a_nested_attributes_collection_associ
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="new comment" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="new comment" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="new comment" id="post_comments_attributes_0_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="new comment" id="post_comments_attributes_1_name" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1456,10 +1484,10 @@ def test_nested_fields_with_existing_and_new_records_on_a_nested_attributes_coll
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #321" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="321" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="new comment" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #321" id="post_comments_attributes_0_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="321" id="post_comments_attributes_0_id"/>' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="new comment" id="post_comments_attributes_1_name" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1474,7 +1502,7 @@ def test_nested_fields_with_an_empty_supplied_attributes_collection
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1491,11 +1519,11 @@ def test_nested_fields_with_existing_records_on_a_supplied_nested_attributes_col
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="1" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][id]" type="hidden" value="2" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" id="post_comments_attributes_0_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="1" id="post_comments_attributes_0_id" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" id="post_comments_attributes_1_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][id]" type="hidden" value="2" id="post_comments_attributes_1_id" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1512,11 +1540,11 @@ def test_nested_fields_arel_like
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="1" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][id]" type="hidden" value="2" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" id="post_comments_attributes_0_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="1" id="post_comments_attributes_0_id" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" id="post_comments_attributes_1_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][id]" type="hidden" value="2" id="post_comments_attributes_1_id" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1547,11 +1575,11 @@ def test_nested_fields_with_existing_records_on_a_supplied_nested_attributes_col
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="1" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][id]" type="hidden" value="2" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #1" id="post_comments_attributes_0_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="1" id="post_comments_attributes_0_id" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="comment #2" id="post_comments_attributes_1_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][id]" type="hidden" value="2" id="post_comments_attributes_1_id" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1570,10 +1598,10 @@ def test_nested_fields_on_a_nested_attributes_collection_association_yields_only
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #321" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="321" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="new comment" />'
|
|
|
|
|
'<input name="post[title]" type="text" value="Hello World" id="post_title" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #321" id="post_comments_attributes_0_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="321" id="post_comments_attributes_0_id" />' \
|
|
|
|
|
'<input name="post[comments_attributes][1][name]" type="text" value="new comment" id="post_comments_attributes_1_name" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1590,8 +1618,8 @@ def test_nested_fields_with_child_index_option_override_on_a_nested_attributes_c
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[comments_attributes][abc][name]" type="text" value="comment #321" />' \
|
|
|
|
|
'<input name="post[comments_attributes][abc][id]" type="hidden" value="321" />'
|
|
|
|
|
'<input name="post[comments_attributes][abc][name]" type="text" value="comment #321" id="post_comments_attributes_abc_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][abc][id]" type="hidden" value="321" id="post_comments_attributes_abc_id" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1607,8 +1635,8 @@ def test_nested_fields_with_child_index_as_lambda_option_override_on_a_nested_at
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[comments_attributes][abc][name]" type="text" value="comment #321" />' \
|
|
|
|
|
'<input name="post[comments_attributes][abc][id]" type="hidden" value="321" />'
|
|
|
|
|
'<input name="post[comments_attributes][abc][name]" type="text" value="comment #321" id="post_comments_attributes_abc_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][abc][id]" type="hidden" value="321" id="post_comments_attributes_abc_id" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1630,8 +1658,8 @@ def test_nested_fields_with_child_index_option_override_on_a_nested_attributes_c
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[comments_attributes][abc][name]" type="text" value="comment #321" />' \
|
|
|
|
|
'<input name="post[comments_attributes][abc][id]" type="hidden" value="321" />'
|
|
|
|
|
'<input name="post[comments_attributes][abc][name]" type="text" value="comment #321" id="post_comments_attributes_abc_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][abc][id]" type="hidden" value="321" id="post_comments_attributes_abc_id" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1716,18 +1744,18 @@ def test_nested_fields_uses_unique_indices_for_different_collection_associations
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #321" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][relevances_attributes][0][value]" type="text" value="commentrelevance #314" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][relevances_attributes][0][id]" type="hidden" value="314" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="321" />' \
|
|
|
|
|
'<input name="post[tags_attributes][0][value]" type="text" value="tag #123" />' \
|
|
|
|
|
'<input name="post[tags_attributes][0][relevances_attributes][0][value]" type="text" value="tagrelevance #3141" />' \
|
|
|
|
|
'<input name="post[tags_attributes][0][relevances_attributes][0][id]" type="hidden" value="3141" />' \
|
|
|
|
|
'<input name="post[tags_attributes][0][id]" type="hidden" value="123" />' \
|
|
|
|
|
'<input name="post[tags_attributes][1][value]" type="text" value="tag #456" />' \
|
|
|
|
|
'<input name="post[tags_attributes][1][relevances_attributes][0][value]" type="text" value="tagrelevance #31415" />' \
|
|
|
|
|
'<input name="post[tags_attributes][1][relevances_attributes][0][id]" type="hidden" value="31415" />' \
|
|
|
|
|
'<input name="post[tags_attributes][1][id]" type="hidden" value="456" />'
|
|
|
|
|
'<input name="post[comments_attributes][0][name]" type="text" value="comment #321" id="post_comments_attributes_0_name" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][relevances_attributes][0][value]" type="text" value="commentrelevance #314" id="post_comments_attributes_0_relevances_attributes_0_value" />' \
|
|
|
|
|
'<input name="post[comments_attributes][0][relevances_attributes][0][id]" type="hidden" value="314" id="post_comments_attributes_0_relevances_attributes_0_id"/>' \
|
|
|
|
|
'<input name="post[comments_attributes][0][id]" type="hidden" value="321" id="post_comments_attributes_0_id"/>' \
|
|
|
|
|
'<input name="post[tags_attributes][0][value]" type="text" value="tag #123" id="post_tags_attributes_0_value"/>' \
|
|
|
|
|
'<input name="post[tags_attributes][0][relevances_attributes][0][value]" type="text" value="tagrelevance #3141" id="post_tags_attributes_0_relevances_attributes_0_value"/>' \
|
|
|
|
|
'<input name="post[tags_attributes][0][relevances_attributes][0][id]" type="hidden" value="3141" id="post_tags_attributes_0_relevances_attributes_0_id"/>' \
|
|
|
|
|
'<input name="post[tags_attributes][0][id]" type="hidden" value="123" id="post_tags_attributes_0_id"/>' \
|
|
|
|
|
'<input name="post[tags_attributes][1][value]" type="text" value="tag #456" id="post_tags_attributes_1_value"/>' \
|
|
|
|
|
'<input name="post[tags_attributes][1][relevances_attributes][0][value]" type="text" value="tagrelevance #31415" id="post_tags_attributes_1_relevances_attributes_0_value"/>' \
|
|
|
|
|
'<input name="post[tags_attributes][1][relevances_attributes][0][id]" type="hidden" value="31415" id="post_tags_attributes_1_relevances_attributes_0_id"/>' \
|
|
|
|
|
'<input name="post[tags_attributes][1][id]" type="hidden" value="456" id="post_tags_attributes_1_id"/>'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1743,7 +1771,7 @@ def test_nested_fields_with_hash_like_model
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="hash backed author" />'
|
|
|
|
|
'<input name="post[author_attributes][name]" type="text" value="hash backed author" id="post_author_attributes_name" />'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1757,10 +1785,10 @@ def test_fields
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected =
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' id='post_title' />" \
|
|
|
|
|
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' />"
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' />"
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
|
end
|
|
|
|
@ -1773,10 +1801,10 @@ def test_fields_with_index
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected =
|
|
|
|
|
"<input name='post[123][title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[123][body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[123][title]' type='text' value='Hello World' id='post_123_title' />" \
|
|
|
|
|
"<textarea name='post[123][body]' id='post_123_body'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[123][secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='post[123][secret]' checked='checked' type='checkbox' value='1' />"
|
|
|
|
|
"<input name='post[123][secret]' checked='checked' type='checkbox' value='1' id='post_123_secret' />"
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
|
end
|
|
|
|
@ -1789,10 +1817,10 @@ def test_fields_with_nil_index_option_override
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected =
|
|
|
|
|
"<input name='post[][title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[][body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[][title]' type='text' value='Hello World' id='post__title' />" \
|
|
|
|
|
"<textarea name='post[][body]' id='post__body'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[][secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='post[][secret]' checked='checked' type='checkbox' value='1' />"
|
|
|
|
|
"<input name='post[][secret]' checked='checked' type='checkbox' value='1' id='post__secret' />"
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
|
end
|
|
|
|
@ -1805,10 +1833,10 @@ def test_fields_with_index_option_override
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected =
|
|
|
|
|
"<input name='post[abc][title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[abc][body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[abc][title]' type='text' value='Hello World' id='post_abc_title' />" \
|
|
|
|
|
"<textarea name='post[abc][body]' id='post_abc_body'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[abc][secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='post[abc][secret]' checked='checked' type='checkbox' value='1' />"
|
|
|
|
|
"<input name='post[abc][secret]' checked='checked' type='checkbox' value='1' id='post_abc_secret' />"
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
|
end
|
|
|
|
@ -1821,10 +1849,10 @@ def test_fields_without_object
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected =
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' id='post_title' />" \
|
|
|
|
|
"<textarea name='post[body]' id='post_body' >\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' />"
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' />"
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
|
end
|
|
|
|
@ -1837,10 +1865,10 @@ def test_fields_with_only_object
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected =
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' id='post_title' />" \
|
|
|
|
|
"<textarea name='post[body]' id='post_body' >\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' />"
|
|
|
|
|
"<input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' />"
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
|
end
|
|
|
|
@ -1852,7 +1880,7 @@ def test_fields_object_with_bracketed_name
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal "<label for=\"author_post_title\">Title</label>" \
|
|
|
|
|
"<input name='author[post][title]' type='text' value='Hello World' />",
|
|
|
|
|
"<input name='author[post][title]' type='text' value='Hello World' id='author_post_title' id='author_post_1_title' />",
|
|
|
|
|
output_buffer
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -1863,7 +1891,7 @@ def test_fields_object_with_bracketed_name_and_index
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal "<label for=\"author_post_1_title\">Title</label>" \
|
|
|
|
|
"<input name='author[post][1][title]' type='text' value='Hello World' />",
|
|
|
|
|
"<input name='author[post][1][title]' type='text' value='Hello World' id='author_post_1_title' />",
|
|
|
|
|
output_buffer
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@ -1882,10 +1910,10 @@ def test_form_with_and_fields
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", "create-post", method: "patch") do
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' id='post_title' />" \
|
|
|
|
|
"<textarea name='post[body]' id='post_body' >\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='parent_post[secret]' type='hidden' value='0' />" \
|
|
|
|
|
"<input name='parent_post[secret]' checked='checked' type='checkbox' value='1' />"
|
|
|
|
|
"<input name='parent_post[secret]' checked='checked' type='checkbox' value='1' id='parent_post_secret' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1902,9 +1930,9 @@ def test_form_with_and_fields_with_object
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", "create-post", method: "patch") do
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' />" \
|
|
|
|
|
"<textarea name='post[body]'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[comment][name]' type='text' value='new comment' />"
|
|
|
|
|
"<input name='post[title]' type='text' value='Hello World' id='post_title' />" \
|
|
|
|
|
"<textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea>" \
|
|
|
|
|
"<input name='post[comment][name]' type='text' value='new comment' id='post_comment_name' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1918,7 +1946,7 @@ def test_form_with_and_fields_with_non_nested_association_and_without_object
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<input name='post[category][name]' type='text' />"
|
|
|
|
|
"<input name='post[category][name]' type='text' id='post_category_name' />"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1942,9 +1970,9 @@ def test_form_with_with_labelled_builder
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<label for='title'>Title:</label> <input name='post[title]' type='text' value='Hello World' /><br/>" \
|
|
|
|
|
"<label for='body'>Body:</label> <textarea name='post[body]'>\nBack to the hill and over it again!</textarea><br/>" \
|
|
|
|
|
"<label for='secret'>Secret:</label> <input name='post[secret]' type='hidden' value='0' /><input name='post[secret]' checked='checked' type='checkbox' value='1' /><br/>"
|
|
|
|
|
"<label for='title'>Title:</label> <input name='post[title]' type='text' value='Hello World' id='post_title'/><br/>" \
|
|
|
|
|
"<label for='body'>Body:</label> <textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea><br/>" \
|
|
|
|
|
"<label for='secret'>Secret:</label> <input name='post[secret]' type='hidden' value='0' /><input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' /><br/>"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1961,9 +1989,9 @@ def test_default_form_builder
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<label for='title'>Title:</label> <input name='post[title]' type='text' value='Hello World' /><br/>" \
|
|
|
|
|
"<label for='body'>Body:</label> <textarea name='post[body]'>\nBack to the hill and over it again!</textarea><br/>" \
|
|
|
|
|
"<label for='secret'>Secret:</label> <input name='post[secret]' type='hidden' value='0' /><input name='post[secret]' checked='checked' type='checkbox' value='1' /><br/>"
|
|
|
|
|
"<label for='title'>Title:</label> <input name='post[title]' type='text' value='Hello World' id='post_title' /><br/>" \
|
|
|
|
|
"<label for='body'>Body:</label> <textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea><br/>" \
|
|
|
|
|
"<label for='secret'>Secret:</label> <input name='post[secret]' type='hidden' value='0' /><input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' /><br/>"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1980,7 +2008,7 @@ def test_lazy_loading_default_form_builder
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = whole_form("/posts/123", method: "patch") do
|
|
|
|
|
"<label for='title'>Title:</label> <input name='post[title]' type='text' value='Hello World' /><br/>"
|
|
|
|
|
"<label for='title'>Title:</label> <input name='post[title]' type='text' value='Hello World' id='post_title' /><br/>"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
@ -1995,7 +2023,7 @@ def test_form_builder_override
|
|
|
|
|
concat f.text_field(:title)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = "<label for='title'>Title:</label> <input name='post[title]' type='text' value='Hello World' /><br/>"
|
|
|
|
|
expected = "<label for='title'>Title:</label> <input name='post[title]' type='text' value='Hello World' id='post_title' /><br/>"
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
|
end
|
|
|
|
@ -2007,7 +2035,7 @@ def test_lazy_loading_form_builder_override
|
|
|
|
|
concat f.text_field(:title)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected = "<label for='title'>Title:</label> <input name='post[title]' type='text' value='Hello World' /><br/>"
|
|
|
|
|
expected = "<label for='title'>Title:</label> <input name='post[title]' type='text' value='Hello World' id='post_title' /><br/>"
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
|
end
|
|
|
|
@ -2020,9 +2048,9 @@ def test_fields_with_labelled_builder
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
expected =
|
|
|
|
|
"<label for='title'>Title:</label> <input name='post[title]' type='text' value='Hello World' /><br/>" \
|
|
|
|
|
"<label for='body'>Body:</label> <textarea name='post[body]'>\nBack to the hill and over it again!</textarea><br/>" \
|
|
|
|
|
"<label for='secret'>Secret:</label> <input name='post[secret]' type='hidden' value='0' /><input name='post[secret]' checked='checked' type='checkbox' value='1' /><br/>"
|
|
|
|
|
"<label for='title'>Title:</label> <input name='post[title]' type='text' value='Hello World' id='post_title'/><br/>" \
|
|
|
|
|
"<label for='body'>Body:</label> <textarea name='post[body]' id='post_body'>\nBack to the hill and over it again!</textarea><br/>" \
|
|
|
|
|
"<label for='secret'>Secret:</label> <input name='post[secret]' type='hidden' value='0' /><input name='post[secret]' checked='checked' type='checkbox' value='1' id='post_secret' /><br/>"
|
|
|
|
|
|
|
|
|
|
assert_dom_equal expected, output_buffer
|
|
|
|
|
end
|
|
|
|
|