diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-10 06:04:50 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-10 06:04:50 +0000 |
commit | adba18106081f55f2e8761b5104d295cacd6a8c6 (patch) | |
tree | 5379929a20cbd2d60d9c860ba1951d6862efdd59 /actionpack/test/template | |
parent | c955f378de859bf433fc56d877050efa5d11c691 (diff) | |
download | rails-adba18106081f55f2e8761b5104d295cacd6a8c6.tar.gz rails-adba18106081f55f2e8761b5104d295cacd6a8c6.tar.bz2 rails-adba18106081f55f2e8761b5104d295cacd6a8c6.zip |
The auto_link text helper accepts an optional block to format the link text for each url and email address. References #2628.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2963 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/text_helper_test.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb index ef6c837c9f..d43bc43b9c 100644 --- a/actionpack/test/template/text_helper_test.rb +++ b/actionpack/test/template/text_helper_test.rb @@ -161,6 +161,13 @@ class TextHelperTest < Test::Unit::TestCase assert_equal %(<p><a href="#{url1}">#{url1}</a><br /><a href="#{url2}">#{url2}</a><br /></p>), auto_link("<p>#{url1}<br />#{url2}<br /></p>") end + def test_auto_link_with_block + url = "http://api.rubyonrails.com/Foo.html" + email = "fantabulous@shiznadel.ic" + + assert_equal %(<p><a href="#{url}">#{url[0..7]}...</a><br /><a href="mailto:#{email}">#{email[0..7]}...</a><br /></p>), auto_link("<p>#{url}<br />#{email}<br /></p>") { |url| truncate(url, 10) } + end + def test_sanitize_form raw = "<form action=\"/foo/bar\" method=\"post\"><input></form>" result = sanitize(raw) |