aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorrizwanreza <rizwanreza@gmail.com>2009-08-08 22:21:25 +0100
committerPratik Naik <pratiknaik@gmail.com>2009-08-08 22:21:32 +0100
commit5786395760f1e1906c878df4023cac3741e66e87 (patch)
treea85a8c2dd8c5a3803103c52d1b04d7f0e6801025 /actionpack/test
parent761283ffdb5750f8a38e2ed67891d2b2b9152d7f (diff)
downloadrails-5786395760f1e1906c878df4023cac3741e66e87.tar.gz
rails-5786395760f1e1906c878df4023cac3741e66e87.tar.bz2
rails-5786395760f1e1906c878df4023cac3741e66e87.zip
Allow content_tag options to take an array [#1741 state:resolved] [rizwanreza, Nick Quaranto]
Example: content_tag('p', "limelight", :class => ["song", "play"]) # => <p class="song play">limelight</p> Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/template/tag_helper_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/test/template/tag_helper_test.rb b/actionpack/test/template/tag_helper_test.rb
index ef88cae5b8..2aa3d5b5fa 100644
--- a/actionpack/test/template/tag_helper_test.rb
+++ b/actionpack/test/template/tag_helper_test.rb
@@ -71,6 +71,19 @@ class TagHelperTest < ActionView::TestCase
assert_equal '<p><b>Hello</b></p>', output_buffer
end
+ def test_content_tag_with_escaped_array_class
+ str = content_tag('p', "limelight", :class => ["song", "play>"])
+ assert_equal "<p class=\"song play&gt;\">limelight</p>", str
+
+ str = content_tag('p', "limelight", :class => ["song", "play"])
+ assert_equal "<p class=\"song play\">limelight</p>", str
+ end
+
+ def test_content_tag_with_unescaped_array_class
+ str = content_tag('p', "limelight", {:class => ["song", "play>"]}, false)
+ assert_equal "<p class=\"song play>\">limelight</p>", str
+ end
+
def test_cdata_section
assert_equal "<![CDATA[<hello world>]]>", cdata_section("<hello world>")
end