Skip to content
This repository

Add a new line after the textarea opening tag. #5191

Merged
merged 1 commit into from about 2 years ago

6 participants

Rafael Mendonça França Aaron Patterson Braden Schaeffer James Coleman John Paul Ashenfelter
Rafael Mendonça França

Closes #393 and related with #4000

Aaron Patterson
Owner

Are you sure this is OK? IIRC some browsers (probably IE) will add text inside the textarea tag if there is a newline.

Rafael Mendonça França

I didn't tried IE, but Firefox, Safari and Chrome ignored the first newline as described in the issue #393.

When I did this snippet:

<textarea>

OMG</textarea>

Only one new line is rendered as content inside the textarea

Aaron Patterson
Owner

Can we get someone to :+1: with IE before merging this?

Rafael Mendonça França

Yeah. I don't have a windows machine here. :sob:

Braden Schaeffer

No new line is rendered in IE 9.0+ for the following:

<textarea>
OMG</textarea>

https://gist.github.com/1926274

Rafael Mendonça França

:cool: I tested here with IE7+ and it worked

Aaron Patterson
Owner

OK! Then I'll merge! :-)

Aaron Patterson tenderlove merged commit a4e4d28 into from
Aaron Patterson tenderlove closed this
James Coleman jcoleman referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
James Coleman jcoleman referenced this pull request from a commit in jcoleman/rails
James Coleman Don't break Haml with textarea newline fix.
See issue #393, issue #4000, issue #5190, and issue #5191. Adds a newline after the textarea opening tag based on @codykrieger's original patch so that we don't cause regressions in Haml-using apps. The regression caused textarea tags to add newlines to the field unintentionally (each update/save added an extra newline.)
3350ba3
James Coleman jcoleman referenced this pull request from a commit in jcoleman/rails
James Coleman Don't break Haml with textarea newline fix.
See issue #393, issue #4000, issue #5190, and issue #5191. Adds a newline after the textarea opening tag based on @codykrieger's original patch so that we don't cause regressions in Haml-using apps. The regression caused textarea tags to add newlines to the field unintentionally (each update/save added an extra newline.)
10e729a
James Coleman jcoleman referenced this pull request from a commit in jcoleman/rails
James Coleman Don't break Haml with textarea newline fix.
See issue #393, issue #4000, issue #5190, and issue #5191. Adds a newline after the textarea opening tag based on @codykrieger's original patch so that we don't cause regressions in Haml-using apps. The regression caused textarea tags to add newlines to the field unintentionally (each update/save added an extra newline.)
5b7066d
James Coleman jcoleman referenced this pull request from a commit in jcoleman/rails
James Coleman Don't break Haml with textarea newline fix.
See issue #393, issue #4000, issue #5190, and issue #5191. Adds a newline after the textarea opening tag based on @codykrieger's original patch so that we don't cause regressions in Haml-using apps. The regression caused textarea tags to add newlines to the field unintentionally (each update/save added an extra newline.)
5edf553
James Coleman jcoleman referenced this pull request from a commit in jcoleman/rails
James Coleman Don't break Haml with textarea newline fix.
See issue #393, issue #4000, issue #5190, and issue #5191. Adds a newline after the textarea opening tag based on @codykrieger's original patch so that we don't cause regressions in Haml-using apps. The regression caused textarea tags to add newlines to the field unintentionally (each update/save added an extra newline.)
d15fad1
James Coleman jcoleman referenced this pull request from a commit in jcoleman/rails
James Coleman Don't break Haml with textarea newline fix.
See issue #393, issue #4000, issue #5190, and issue #5191. Adds a newline after the textarea opening tag based on @codykrieger's original patch so that we don't cause regressions in Haml-using apps. The regression caused textarea tags to add newlines to the field unintentionally (each update/save added an extra newline.)

Also fix 6 more tests that didn't yet have the newline expectation.
d843c80
James Coleman jcoleman referenced this pull request from a commit in jcoleman/rails
James Coleman Don't break Haml with textarea newline fix.
See issue #393, issue #4000, issue #5190, and issue #5191. Adds a newline after the textarea opening tag based on @codykrieger's original patch so that we don't cause regressions in Haml-using apps. The regression caused textarea tags to add newlines to the field unintentionally (each update/save added an extra newline.)

Also fix 6 more tests that didn't yet have the newline expectation.
a7a422e
James Coleman jcoleman referenced this pull request from a commit in jcoleman/rails
James Coleman Don't break Haml with textarea newline fix.
See issue #393, issue #4000, issue #5190, and issue #5191. Adds a newline after the textarea opening tag based on @codykrieger's original patch so that we don't cause regressions in Haml-using apps. The regression caused textarea tags to add newlines to the field unintentionally (each update/save added an extra newline.)

Also fix 6 more tests that didn't yet have the newline expectation.
1438e0e

Seems like rack-test does not properly render this newline. When testing manually or with Selenium it is ok but if driver is rack-test it adds another newline every time, and saves it to the DB. The app with tests is here: https://github.com/khustochka/newline_test

Please excuse if I am doing something wrong

James Coleman

It sounds like a bug in rack-test. That is, browsers eat the first newline inside a textarea tag, so rack-test should respect that behavior and not treat the first newline as part of the actual content.

But since Rails hasn't match the way the browser works until now (this bug existed in Rails 1 even is my understanding) I wouldn't be surprised to find that rack-test had been written to match Rails behavior rather than browser behavior.

Robin Roestenburg robinroestenburg referenced this pull request from a commit
James Coleman Don't break Haml with textarea newline fix.
See issue #393, issue #4000, issue #5190, and issue #5191. Adds a newline after the textarea opening tag based on @codykrieger's original patch so that we don't cause regressions in Haml-using apps. The regression caused textarea tags to add newlines to the field unintentionally (each update/save added an extra newline.)

Also fix 6 more tests that didn't yet have the newline expectation.
b50b3f4
John Paul Ashenfelter

I tried to follow through the reasoning here -- but cucumber + capybara now has my textarea tests failing since it's expecting the textarea to be "String" and is instead getting "\nString"

Does this mean that there's a patch needed for rack-test, capybara, or both?

@johnpaulashenfelter, the reason is in Capybara's rack-test driver and my patch fixing it was accepted to capybara just today.

John Paul Ashenfelter

@khustochka super. that was a surprising set of errors to get :)

Jonathan Perkin jperkin referenced this pull request from a commit in joyent/pkgsrc
Update www/ruby-actionpack32 to 3.3.2.
## Rails 3.2.3 (unreleased) ##

*   Remove the leading \n added by textarea on assert_select. *Santiago Pastorino*

*   Fix #5632, render :inline set the proper rendered format. *Santiago Pastorino*

*   Fix textarea rendering when using plugins like HAML. Such plugins encode the first newline character in the content. This issue was introduced in rails/rails#5191 *James Coleman*

*   Add `config.action_view.embed_authenticity_token_in_remote_forms` (defaults to true) which allows to set if authenticity token will be included by default in remote forms. If you change it to false, you can still force authenticity token by passing `:authenticity_token => true` in form options *Piotr Sarnacki*

*   Do not include the authenticity token in forms where remote: true as ajax forms use the meta-tag value *DHH*

*   Turn off verbose mode of rack-cache, we still have X-Rack-Cache to
    check that info. Closes #5245. *Santiago Pastorino*

*   Fix #5238, rendered_format is not set when template is not rendered. *Piotr Sarnacki*

*   Upgrade rack-cache to 1.2. *José Valim*

*   ActionController::SessionManagement is deprecated. *Santiago Pastorino*

*   Since the router holds references to many parts of the system like engines, controllers and the application itself, inspecting the route set can actually be really slow, therefore we default alias inspect to to_s. *José Valim*

*   Add a new line after the textarea opening tag. Closes #393 *Rafael Mendonça França*

*   Always pass a respond block from to responder. We should let the responder to decide what to do with the given overridden response block, and not short circuit it. *sikachu*

*   Fixes layout rendering regression from 3.2.2. *José Valim*
c434cd3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Feb 27, 2012
Rafael Mendonça França Add a new line after the textarea opening tag.
Closes #393
a6074c3
This page is out of date. Refresh to see the latest.
2  actionpack/lib/action_view/helpers/tags/text_area.rb
@@ -12,7 +12,7 @@ def render
12 12
             options["cols"], options["rows"] = size.split("x") if size.respond_to?(:split)
13 13
           end
14 14
 
15  
-          content_tag("textarea", ERB::Util.html_escape(options.delete('value') || value_before_type_cast(object)), options)
  15
+          content_tag("textarea", "\n#{options.delete('value') || value_before_type_cast(object)}", options)
16 16
         end
17 17
       end
18 18
     end
2  actionpack/test/template/active_model_helper_test.rb
@@ -29,7 +29,7 @@ def setup
29 29
 
30 30
   def test_text_area_with_errors
31 31
     assert_dom_equal(
32  
-      %(<div class="field_with_errors"><textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea></div>),
  32
+      %(<div class="field_with_errors"><textarea cols="40" id="post_body" name="post[body]" rows="20">\nBack to the hill and over it again!</textarea></div>),
33 33
       text_area("post", "body")
34 34
     )
35 35
   end
72  actionpack/test/template/form_helper_test.rb
@@ -474,7 +474,7 @@ def test_radio_button_with_booleans
474 474
 
475 475
   def test_text_area
476 476
     assert_dom_equal(
477  
-      '<textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea>',
  477
+      %{<textarea cols="40" id="post_body" name="post[body]" rows="20">\nBack to the hill and over it again!</textarea>},
478 478
       text_area("post", "body")
479 479
     )
480 480
   end
@@ -482,14 +482,14 @@ def test_text_area
482 482
   def test_text_area_with_escapes
483 483
     @post.body        = "Back to <i>the</i> hill and over it again!"
484 484
     assert_dom_equal(
485  
-      '<textarea cols="40" id="post_body" name="post[body]" rows="20">Back to &lt;i&gt;the&lt;/i&gt; hill and over it again!</textarea>',
  485
+      %{<textarea cols="40" id="post_body" name="post[body]" rows="20">\nBack to &lt;i&gt;the&lt;/i&gt; hill and over it again!</textarea>},
486 486
       text_area("post", "body")
487 487
     )
488 488
   end
489 489
 
490 490
   def test_text_area_with_alternate_value
491 491
     assert_dom_equal(
492  
-      '<textarea cols="40" id="post_body" name="post[body]" rows="20">Testing alternate values.</textarea>',
  492
+      %{<textarea cols="40" id="post_body" name="post[body]" rows="20">\nTesting alternate values.</textarea>},
493 493
       text_area("post", "body", :value => 'Testing alternate values.')
494 494
     )
495 495
   end
@@ -497,14 +497,14 @@ def test_text_area_with_alternate_value
497 497
   def test_text_area_with_html_entities
498 498
     @post.body        = "The HTML Entity for & is &amp;"
499 499
     assert_dom_equal(
500  
-      '<textarea cols="40" id="post_body" name="post[body]" rows="20">The HTML Entity for &amp; is &amp;amp;</textarea>',
  500
+      %{<textarea cols="40" id="post_body" name="post[body]" rows="20">\nThe HTML Entity for &amp; is &amp;amp;</textarea>},
501 501
       text_area("post", "body")
502 502
     )
503 503
   end
504 504
 
505 505
   def test_text_area_with_size_option
506 506
     assert_dom_equal(
507  
-      '<textarea cols="183" id="post_body" name="post[body]" rows="820">Back to the hill and over it again!</textarea>',
  507
+      %{<textarea cols="183" id="post_body" name="post[body]" rows="820">\nBack to the hill and over it again!</textarea>},
508 508
       text_area("post", "body", :size => "183x820")
509 509
     )
510 510
   end
@@ -574,7 +574,7 @@ def test_explicit_name
574 574
       '<input id="post_title" name="dont guess" size="30" type="text" value="Hello World" />', text_field("post", "title", "name" => "dont guess")
575 575
     )
576 576
     assert_dom_equal(
577  
-      '<textarea cols="40" id="post_body" name="really!" rows="20">Back to the hill and over it again!</textarea>',
  577
+      %{<textarea cols="40" id="post_body" name="really!" rows="20">\nBack to the hill and over it again!</textarea>},
578 578
       text_area("post", "body", "name" => "really!")
579 579
     )
580 580
     assert_dom_equal(
@@ -594,7 +594,7 @@ def test_explicit_id
594 594
       '<input id="dont guess" name="post[title]" size="30" type="text" value="Hello World" />', text_field("post", "title", "id" => "dont guess")
595 595
     )
596 596
     assert_dom_equal(
597  
-      '<textarea cols="40" id="really!" name="post[body]" rows="20">Back to the hill and over it again!</textarea>',
  597
+      %{<textarea cols="40" id="really!" name="post[body]" rows="20">\nBack to the hill and over it again!</textarea>},
598 598
       text_area("post", "body", "id" => "really!")
599 599
     )
600 600
     assert_dom_equal(
@@ -614,7 +614,7 @@ def test_nil_id
614 614
       '<input name="post[title]" size="30" type="text" value="Hello World" />', text_field("post", "title", "id" => nil)
615 615
     )
616 616
     assert_dom_equal(
617  
-      '<textarea cols="40" name="post[body]" rows="20">Back to the hill and over it again!</textarea>',
  617
+      %{<textarea cols="40" name="post[body]" rows="20">\nBack to the hill and over it again!</textarea>},
618 618
       text_area("post", "body", "id" => nil)
619 619
     )
620 620
     assert_dom_equal(
@@ -645,7 +645,7 @@ def test_index
645 645
       text_field("post", "title", "index" => 5)
646 646
     )
647 647
     assert_dom_equal(
648  
-      '<textarea cols="40" name="post[5][body]" id="post_5_body" rows="20">Back to the hill and over it again!</textarea>',
  648
+      %{<textarea cols="40" name="post[5][body]" id="post_5_body" rows="20">\nBack to the hill and over it again!</textarea>},
649 649
       text_area("post", "body", "index" => 5)
650 650
     )
651 651
     assert_dom_equal(
@@ -672,7 +672,7 @@ def test_index_with_nil_id
672 672
       text_field("post", "title", "index" => 5, 'id' => nil)
673 673
     )
674 674
     assert_dom_equal(
675  
-      '<textarea cols="40" name="post[5][body]" rows="20">Back to the hill and over it again!</textarea>',
  675
+      %{<textarea cols="40" name="post[5][body]" rows="20">\nBack to the hill and over it again!</textarea>},
676 676
       text_area("post", "body", "index" => 5, 'id' => nil)
677 677
     )
678 678
     assert_dom_equal(
@@ -703,7 +703,7 @@ def test_auto_index
703 703
       "<input id=\"post_#{pid}_title\" name=\"post[#{pid}][title]\" size=\"30\" type=\"text\" value=\"Hello World\" />", text_field("post[]","title")
704 704
     )
705 705
     assert_dom_equal(
706  
-      "<textarea cols=\"40\" id=\"post_#{pid}_body\" name=\"post[#{pid}][body]\" rows=\"20\">Back to the hill and over it again!</textarea>",
  706
+      "<textarea cols=\"40\" id=\"post_#{pid}_body\" name=\"post[#{pid}][body]\" rows=\"20\">\nBack to the hill and over it again!</textarea>",
707 707
       text_area("post[]", "body")
708 708
     )
709 709
     assert_dom_equal(
@@ -711,7 +711,7 @@ def test_auto_index
711 711
       check_box("post[]", "secret")
712 712
     )
713 713
    assert_dom_equal(
714  
-"<input checked=\"checked\" id=\"post_#{pid}_title_hello_world\" name=\"post[#{pid}][title]\" type=\"radio\" value=\"Hello World\" />",
  714
+      "<input checked=\"checked\" id=\"post_#{pid}_title_hello_world\" name=\"post[#{pid}][title]\" type=\"radio\" value=\"Hello World\" />",
715 715
       radio_button("post[]", "title", "Hello World")
716 716
     )
717 717
     assert_dom_equal("<input id=\"post_#{pid}_title_goodbye_world\" name=\"post[#{pid}][title]\" type=\"radio\" value=\"Goodbye World\" />",
@@ -726,7 +726,7 @@ def test_auto_index_with_nil_id
726 726
       text_field("post[]","title", :id => nil)
727 727
     )
728 728
     assert_dom_equal(
729  
-      "<textarea cols=\"40\" name=\"post[#{pid}][body]\" rows=\"20\">Back to the hill and over it again!</textarea>",
  729
+      "<textarea cols=\"40\" name=\"post[#{pid}][body]\" rows=\"20\">\nBack to the hill and over it again!</textarea>",
730 730
       text_area("post[]", "body", :id => nil)
731 731
     )
732 732
     assert_dom_equal(
@@ -761,7 +761,7 @@ def test_form_for
761 761
     expected = whole_form("/posts/123", "create-post" , "edit_post", :method => 'patch') do
762 762
       "<label for='post_title'>The Title</label>" +
763 763
       "<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" +
764  
-      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  764
+      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
765 765
       "<input name='post[secret]' type='hidden' value='0' />" +
766 766
       "<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />" +
767 767
       "<input name='commit' type='submit' value='Create post' />" +
@@ -878,7 +878,7 @@ def test_form_for_with_symbol_object_name
878 878
     expected =  whole_form("/posts/123", "create-post", "edit_other_name", :method => 'patch') do
879 879
       "<label for='other_name_title' class='post_title'>Title</label>" +
880 880
       "<input name='other_name[title]' size='30' id='other_name_title' value='Hello World' type='text' />" +
881  
-      "<textarea name='other_name[body]' id='other_name_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  881
+      "<textarea name='other_name[body]' id='other_name_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
882 882
       "<input name='other_name[secret]' value='0' type='hidden' />" +
883 883
       "<input name='other_name[secret]' checked='checked' id='other_name_secret' value='1' type='checkbox' />" +
884 884
       "<input name='commit' value='Create post' type='submit' />"
@@ -896,7 +896,7 @@ def test_form_for_with_method_as_part_of_html_options
896 896
 
897 897
     expected =  whole_form("/", "create-post", "edit_post", "delete") do
898 898
       "<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" +
899  
-      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  899
+      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
900 900
       "<input name='post[secret]' type='hidden' value='0' />" +
901 901
       "<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
902 902
     end
@@ -913,7 +913,7 @@ def test_form_for_with_method
913 913
 
914 914
     expected =  whole_form("/", "create-post", "edit_post", "delete") do
915 915
       "<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" +
916  
-      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  916
+      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
917 917
       "<input name='post[secret]' type='hidden' value='0' />" +
918 918
       "<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
919 919
     end
@@ -944,7 +944,7 @@ def test_form_for_with_remote
944 944
 
945 945
     expected =  whole_form("/", "create-post", "edit_post", :method => 'patch', :remote => true) do
946 946
       "<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" +
947  
-      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  947
+      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
948 948
       "<input name='post[secret]' type='hidden' value='0' />" +
949 949
       "<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
950 950
     end
@@ -961,7 +961,7 @@ def test_form_for_with_remote_in_html
961 961
 
962 962
     expected =  whole_form("/", "create-post", "edit_post", :method => 'patch', :remote => true) do
963 963
       "<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" +
964  
-      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  964
+      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
965 965
       "<input name='post[secret]' type='hidden' value='0' />" +
966 966
       "<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
967 967
     end
@@ -980,7 +980,7 @@ def test_form_for_with_remote_without_html
980 980
 
981 981
     expected =  whole_form("/posts", 'new_post', 'new_post', :remote => true) do
982 982
       "<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" +
983  
-      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  983
+      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
984 984
       "<input name='post[secret]' type='hidden' value='0' />" +
985 985
       "<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
986 986
     end
@@ -997,7 +997,7 @@ def test_form_for_without_object
997 997
 
998 998
     expected = whole_form("/", "create-post") do
999 999
       "<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" +
1000  
-      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  1000
+      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
1001 1001
       "<input name='post[secret]' type='hidden' value='0' />" +
1002 1002
       "<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
1003 1003
     end
@@ -1016,7 +1016,7 @@ def test_form_for_with_index
1016 1016
     expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', 'patch') do
1017 1017
       "<label for='post_123_title'>Title</label>" +
1018 1018
       "<input name='post[123][title]' size='30' type='text' id='post_123_title' value='Hello World' />" +
1019  
-      "<textarea name='post[123][body]' id='post_123_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  1019
+      "<textarea name='post[123][body]' id='post_123_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
1020 1020
       "<input name='post[123][secret]' type='hidden' value='0' />" +
1021 1021
       "<input name='post[123][secret]' checked='checked' type='checkbox' id='post_123_secret' value='1' />"
1022 1022
     end
@@ -1033,7 +1033,7 @@ def test_form_for_with_nil_index_option_override
1033 1033
 
1034 1034
     expected = whole_form('/posts/123', 'edit_post[]', 'edit_post[]', 'patch') do
1035 1035
       "<input name='post[][title]' size='30' type='text' id='post__title' value='Hello World' />" +
1036  
-      "<textarea name='post[][body]' id='post__body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  1036
+      "<textarea name='post[][body]' id='post__body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
1037 1037
       "<input name='post[][secret]' type='hidden' value='0' />" +
1038 1038
       "<input name='post[][secret]' checked='checked' type='checkbox' id='post__secret' value='1' />"
1039 1039
     end
@@ -1050,7 +1050,7 @@ def test_form_for_with_namespace
1050 1050
 
1051 1051
     expected = whole_form('/posts/123', 'namespace_edit_post_123', 'edit_post', 'patch') do
1052 1052
       "<input name='post[title]' size='30' type='text' id='namespace_post_title' value='Hello World' />" +
1053  
-      "<textarea name='post[body]' id='namespace_post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  1053
+      "<textarea name='post[body]' id='namespace_post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
1054 1054
       "<input name='post[secret]' type='hidden' value='0' />" +
1055 1055
       "<input name='post[secret]' checked='checked' type='checkbox' id='namespace_post_secret' value='1' />"
1056 1056
     end
@@ -1110,7 +1110,7 @@ def test_fields_for_with_namespace
1110 1110
 
1111 1111
     expected = whole_form('/posts/123', 'namespace_edit_post_123', 'edit_post', 'patch') do
1112 1112
       "<input name='post[title]' size='30' type='text' id='namespace_post_title' value='Hello World' />" +
1113  
-      "<textarea name='post[body]' id='namespace_post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  1113
+      "<textarea name='post[body]' id='namespace_post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
1114 1114
       "<input name='post[comment][body]' size='30' type='text' id='namespace_post_comment_body' value='Hello World' />"
1115 1115
     end
1116 1116
 
@@ -1845,7 +1845,7 @@ def test_fields_for
1845 1845
 
1846 1846
     expected =
1847 1847
       "<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" +
1848  
-      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  1848
+      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
1849 1849
       "<input name='post[secret]' type='hidden' value='0' />" +
1850 1850
       "<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
1851 1851
 
@@ -1861,7 +1861,7 @@ def test_fields_for_with_index
1861 1861
 
1862 1862
     expected =
1863 1863
       "<input name='post[123][title]' size='30' type='text' id='post_123_title' value='Hello World' />" +
1864  
-      "<textarea name='post[123][body]' id='post_123_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  1864
+      "<textarea name='post[123][body]' id='post_123_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
1865 1865
       "<input name='post[123][secret]' type='hidden' value='0' />" +
1866 1866
       "<input name='post[123][secret]' checked='checked' type='checkbox' id='post_123_secret' value='1' />"
1867 1867
 
@@ -1877,7 +1877,7 @@ def test_fields_for_with_nil_index_option_override
1877 1877
 
1878 1878
     expected =
1879 1879
       "<input name='post[][title]' size='30' type='text' id='post__title' value='Hello World' />" +
1880  
-      "<textarea name='post[][body]' id='post__body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  1880
+      "<textarea name='post[][body]' id='post__body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
1881 1881
       "<input name='post[][secret]' type='hidden' value='0' />" +
1882 1882
       "<input name='post[][secret]' checked='checked' type='checkbox' id='post__secret' value='1' />"
1883 1883
 
@@ -1893,7 +1893,7 @@ def test_fields_for_with_index_option_override
1893 1893
 
1894 1894
     expected =
1895 1895
       "<input name='post[abc][title]' size='30' type='text' id='post_abc_title' value='Hello World' />" +
1896  
-      "<textarea name='post[abc][body]' id='post_abc_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  1896
+      "<textarea name='post[abc][body]' id='post_abc_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
1897 1897
       "<input name='post[abc][secret]' type='hidden' value='0' />" +
1898 1898
       "<input name='post[abc][secret]' checked='checked' type='checkbox' id='post_abc_secret' value='1' />"
1899 1899
 
@@ -1909,7 +1909,7 @@ def test_fields_for_without_object
1909 1909
 
1910 1910
     expected =
1911 1911
       "<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" +
1912  
-      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  1912
+      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
1913 1913
       "<input name='post[secret]' type='hidden' value='0' />" +
1914 1914
       "<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
1915 1915
 
@@ -1925,7 +1925,7 @@ def test_fields_for_with_only_object
1925 1925
 
1926 1926
     expected =
1927 1927
       "<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" +
1928  
-      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  1928
+      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
1929 1929
       "<input name='post[secret]' type='hidden' value='0' />" +
1930 1930
       "<input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' />"
1931 1931
 
@@ -1970,7 +1970,7 @@ def test_form_for_and_fields_for
1970 1970
 
1971 1971
     expected = whole_form('/posts/123', 'create-post', 'edit_post', :method => 'patch') do
1972 1972
       "<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" +
1973  
-      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  1973
+      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
1974 1974
       "<input name='parent_post[secret]' type='hidden' value='0' />" +
1975 1975
       "<input name='parent_post[secret]' checked='checked' type='checkbox' id='parent_post_secret' value='1' />"
1976 1976
     end
@@ -1990,7 +1990,7 @@ def test_form_for_and_fields_for_with_object
1990 1990
 
1991 1991
     expected = whole_form('/posts/123', 'create-post', 'edit_post', :method => 'patch') do
1992 1992
       "<input name='post[title]' size='30' type='text' id='post_title' value='Hello World' />" +
1993  
-      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
  1993
+      "<textarea name='post[body]' id='post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea>" +
1994 1994
       "<input name='post[comment][name]' type='text' id='post_comment_name' value='new comment' size='30' />"
1995 1995
     end
1996 1996
 
@@ -2030,7 +2030,7 @@ def test_form_for_with_labelled_builder
2030 2030
 
2031 2031
     expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do
2032 2032
       "<label for='title'>Title:</label> <input name='post[title]' size='30' type='text' id='post_title' value='Hello World' /><br/>" +
2033  
-      "<label for='body'>Body:</label> <textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea><br/>" +
  2033
+      "<label for='body'>Body:</label> <textarea name='post[body]' id='post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea><br/>" +
2034 2034
       "<label for='secret'>Secret:</label> <input name='post[secret]' type='hidden' value='0' /><input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' /><br/>"
2035 2035
     end
2036 2036
 
@@ -2049,7 +2049,7 @@ def test_default_form_builder
2049 2049
 
2050 2050
     expected = whole_form('/posts/123', 'edit_post_123', 'edit_post', :method => 'patch') do
2051 2051
       "<label for='title'>Title:</label> <input name='post[title]' size='30' type='text' id='post_title' value='Hello World' /><br/>" +
2052  
-      "<label for='body'>Body:</label> <textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea><br/>" +
  2052
+      "<label for='body'>Body:</label> <textarea name='post[body]' id='post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea><br/>" +
2053 2053
       "<label for='secret'>Secret:</label> <input name='post[secret]' type='hidden' value='0' /><input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' /><br/>"
2054 2054
     end
2055 2055
 
@@ -2067,7 +2067,7 @@ def test_fields_for_with_labelled_builder
2067 2067
 
2068 2068
     expected =
2069 2069
       "<label for='title'>Title:</label> <input name='post[title]' size='30' type='text' id='post_title' value='Hello World' /><br/>" +
2070  
-      "<label for='body'>Body:</label> <textarea name='post[body]' id='post_body' rows='20' cols='40'>Back to the hill and over it again!</textarea><br/>" +
  2070
+      "<label for='body'>Body:</label> <textarea name='post[body]' id='post_body' rows='20' cols='40'>\nBack to the hill and over it again!</textarea><br/>" +
2071 2071
       "<label for='secret'>Secret:</label> <input name='post[secret]' type='hidden' value='0' /><input name='post[secret]' checked='checked' type='checkbox' id='post_secret' value='1' /><br/>"
2072 2072
 
2073 2073
     assert_dom_equal expected, output_buffer
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.