aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-07-02 06:46:41 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-07-02 06:46:41 +0000
commita53372c273a06681c3e4e51faa5b0f7757d35d0b (patch)
tree3e01a29582ab4b85d10e67dc1e98722ff380f840 /actionpack/test
parent3553b59d3c27ed06dfa9bb5a2265e101d2f3c2f6 (diff)
downloadrails-a53372c273a06681c3e4e51faa5b0f7757d35d0b.tar.gz
rails-a53372c273a06681c3e4e51faa5b0f7757d35d0b.tar.bz2
rails-a53372c273a06681c3e4e51faa5b0f7757d35d0b.zip
Added that UrlHelper#mail_to will now also encode the default link title #749 [f.svehla@gmail.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1601 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/template/active_record_helper_test.rb6
-rw-r--r--actionpack/test/template/form_helper_test.rb12
-rw-r--r--actionpack/test/template/url_helper_test.rb8
3 files changed, 17 insertions, 9 deletions
diff --git a/actionpack/test/template/active_record_helper_test.rb b/actionpack/test/template/active_record_helper_test.rb
index a57df0d031..853f37660f 100644
--- a/actionpack/test/template/active_record_helper_test.rb
+++ b/actionpack/test/template/active_record_helper_test.rb
@@ -65,7 +65,7 @@ class ActiveRecordHelperTest < Test::Unit::TestCase
def test_text_area_with_errors
assert_equal(
- %(<div class="fieldWithErrors"><textarea cols="40" id="post_body" name="post[body]" rows="20" wrap="virtual">Back to the hill and over it again!</textarea></div>),
+ %(<div class="fieldWithErrors"><textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea></div>),
text_area("post", "body")
)
end
@@ -79,7 +79,7 @@ class ActiveRecordHelperTest < Test::Unit::TestCase
def test_form_with_string
assert_equal(
- %(<form action="create" method="post"><p><label for="post_title">Title</label><br /><input id="post_title" name="post[title]" size="30" type="text" value="Hello World" /></p>\n<p><label for="post_body">Body</label><br /><div class="fieldWithErrors"><textarea cols="40" id="post_body" name="post[body]" rows="20" wrap="virtual">Back to the hill and over it again!</textarea></div></p><input name="commit" type="submit" value="Create" /></form>),
+ %(<form action="create" method="post"><p><label for="post_title">Title</label><br /><input id="post_title" name="post[title]" size="30" type="text" value="Hello World" /></p>\n<p><label for="post_body">Body</label><br /><div class="fieldWithErrors"><textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea></div></p><input name="commit" type="submit" value="Create" /></form>),
form("post")
)
@@ -89,7 +89,7 @@ class ActiveRecordHelperTest < Test::Unit::TestCase
def id() 1 end
end
assert_equal(
- %(<form action="update/1" method="post"><input id="post_id" name="post[id]" type="hidden" value="1" /><p><label for="post_title">Title</label><br /><input id="post_title" name="post[title]" size="30" type="text" value="Hello World" /></p>\n<p><label for="post_body">Body</label><br /><div class="fieldWithErrors"><textarea cols="40" id="post_body" name="post[body]" rows="20" wrap="virtual">Back to the hill and over it again!</textarea></div></p><input name="commit" type="submit" value="Update" /></form>),
+ %(<form action="update/1" method="post"><input id="post_id" name="post[id]" type="hidden" value="1" /><p><label for="post_title">Title</label><br /><input id="post_title" name="post[title]" size="30" type="text" value="Hello World" /></p>\n<p><label for="post_body">Body</label><br /><div class="fieldWithErrors"><textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea></div></p><input name="commit" type="submit" value="Update" /></form>),
form("post")
)
end
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb
index 4e1af744b5..b76f21d80b 100644
--- a/actionpack/test/template/form_helper_test.rb
+++ b/actionpack/test/template/form_helper_test.rb
@@ -100,7 +100,7 @@ class FormHelperTest < Test::Unit::TestCase
def test_text_area
assert_equal(
- '<textarea cols="40" id="post_body" name="post[body]" rows="20" wrap="virtual">Back to the hill and over it again!</textarea>',
+ '<textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea>',
text_area("post", "body")
)
end
@@ -108,14 +108,14 @@ class FormHelperTest < Test::Unit::TestCase
def test_text_area_with_escapes
@post.body = "Back to <i>the</i> hill and over it again!"
assert_equal(
- '<textarea cols="40" id="post_body" name="post[body]" rows="20" wrap="virtual">Back to &lt;i&gt;the&lt;/i&gt; hill and over it again!</textarea>',
+ '<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>',
text_area("post", "body")
)
end
def test_date_selects
assert_equal(
- '<textarea cols="40" id="post_body" name="post[body]" rows="20" wrap="virtual">Back to the hill and over it again!</textarea>',
+ '<textarea cols="40" id="post_body" name="post[body]" rows="20">Back to the hill and over it again!</textarea>',
text_area("post", "body")
)
end
@@ -125,7 +125,7 @@ class FormHelperTest < Test::Unit::TestCase
'<input id="post_title" name="dont guess" size="30" type="text" value="Hello World" />', text_field("post", "title", "name" => "dont guess")
)
assert_equal(
- '<textarea cols="40" id="post_body" name="really!" rows="20" wrap="virtual">Back to the hill and over it again!</textarea>',
+ '<textarea cols="40" id="post_body" name="really!" rows="20">Back to the hill and over it again!</textarea>',
text_area("post", "body", "name" => "really!")
)
assert_equal(
@@ -145,7 +145,7 @@ class FormHelperTest < Test::Unit::TestCase
'<input id="dont guess" name="post[title]" size="30" type="text" value="Hello World" />', text_field("post", "title", "id" => "dont guess")
)
assert_equal(
- '<textarea cols="40" id="really!" name="post[body]" rows="20" wrap="virtual">Back to the hill and over it again!</textarea>',
+ '<textarea cols="40" id="really!" name="post[body]" rows="20">Back to the hill and over it again!</textarea>',
text_area("post", "body", "id" => "really!")
)
assert_equal(
@@ -166,7 +166,7 @@ class FormHelperTest < Test::Unit::TestCase
"<input id=\"post_#{pid}_title\" name=\"post[#{pid}][title]\" size=\"30\" type=\"text\" value=\"Hello World\" />", text_field("post[]","title")
)
assert_equal(
- "<textarea cols=\"40\" id=\"post_#{pid}_body\" name=\"post[#{pid}][body]\" rows=\"20\" wrap=\"virtual\">Back to the hill and over it again!</textarea>",
+ "<textarea cols=\"40\" id=\"post_#{pid}_body\" name=\"post[#{pid}][body]\" rows=\"20\">Back to the hill and over it again!</textarea>",
text_area("post[]", "body")
)
assert_equal(
diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb
index f208466118..0b75528176 100644
--- a/actionpack/test/template/url_helper_test.rb
+++ b/actionpack/test/template/url_helper_test.rb
@@ -116,6 +116,14 @@ class UrlHelperTest < Test::Unit::TestCase
assert_equal "<a href=\"mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d\">My email</a>", mail_to("me@domain.com", "My email", :encode => "hex")
end
+ def test_mail_to_with_replace_options
+ assert_equal "<a href=\"mailto:wolfgang@stufenlos.net\">wolfgang(at)stufenlos(dot)net</a>", mail_to("wolfgang@stufenlos.net", nil, :replace_at => "(at)", :replace_dot => "(dot)")
+ assert_equal "<a href=\"mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d\">me(at)domain.com</a>", mail_to("me@domain.com", nil, :encode => "hex", :replace_at => "(at)")
+ assert_equal "<a href=\"mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d\">My email</a>", mail_to("me@domain.com", "My email", :encode => "hex", :replace_at => "(at)")
+ assert_equal "<a href=\"mailto:%6d%65@%64%6f%6d%61%69%6e.%63%6f%6d\">me(at)domain(dot)com</a>", mail_to("me@domain.com", nil, :encode => "hex", :replace_at => "(at)", :replace_dot => "(dot)")
+ assert_equal "<script type=\"text/javascript\" language=\"javascript\">eval(unescape('%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%22%3e%4d%79%20%65%6d%61%69%6c%3c%2f%61%3e%27%29%3b'))</script>", mail_to("me@domain.com", "My email", :encode => "javascript", :replace_at => "(at)", :replace_dot => "(dot)")
+ end
+
def test_link_with_nil_html_options
assert_equal "<a href=\"http://www.example.com\">Hello</a>", link_to("Hello", {:action => 'myaction'}, nil)
end