aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/tag_helper_test.rb
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2006-10-18 15:58:07 +0000
committerRick Olson <technoweenie@gmail.com>2006-10-18 15:58:07 +0000
commit02358c83b76f9fc56b6cabaee24b244d17d08cff (patch)
tree88b5b9b207163e5d5ceb48e6e7c672c78dc65d91 /actionpack/test/template/tag_helper_test.rb
parenta0f74092a8fa1eff96de67b70c711fd8408a4ab5 (diff)
downloadrails-02358c83b76f9fc56b6cabaee24b244d17d08cff.tar.gz
rails-02358c83b76f9fc56b6cabaee24b244d17d08cff.tar.bz2
rails-02358c83b76f9fc56b6cabaee24b244d17d08cff.zip
Fix double-escaped entities, such as &amp;amp;, &amp;#123;, etc. [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5321 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template/tag_helper_test.rb')
-rw-r--r--actionpack/test/template/tag_helper_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/template/tag_helper_test.rb b/actionpack/test/template/tag_helper_test.rb
index b45be96959..8611f4c9bd 100644
--- a/actionpack/test/template/tag_helper_test.rb
+++ b/actionpack/test/template/tag_helper_test.rb
@@ -38,4 +38,16 @@ class TagHelperTest < Test::Unit::TestCase
def test_cdata_section
assert_equal "<![CDATA[<hello world>]]>", cdata_section("<hello world>")
end
+
+ def test_double_escaping_attributes
+ ['1&amp;2', '1 &lt; 2', '&#8220;test&#8220;'].each do |escaped|
+ assert_equal %(<a href="#{escaped}" />), tag('a', :href => escaped)
+ end
+ end
+
+ def test_skip_invalid_escaped_attributes
+ ['&1;', '&#1dfa3;', '& #123;'].each do |escaped|
+ assert_equal %(<a href="#{escaped.gsub /&/, '&amp;'}" />), tag('a', :href => escaped)
+ end
+ end
end