Fixed: Textile image with style attribute cause internal server error.

Also added tests for inline images with attributes and moved auto_link and auto_mailto rules after textile rules.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1017 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-12-19 21:06:06 +00:00
parent bf3b2ec973
commit 5f871e9657
3 changed files with 16 additions and 9 deletions

View File

@@ -44,12 +44,18 @@ class ApplicationHelperTest < HelperTestCase
textilizable('test@foo.bar')
end
def test_textile_tags
def test_inline_images
to_test = {
# inline images
'!http://foo.bar/image.jpg!' => '<img src="http://foo.bar/image.jpg" alt="" />',
'floating !>http://foo.bar/image.jpg!' => 'floating <div style="float:right"><img src="http://foo.bar/image.jpg" alt="" /></div>',
# textile links
'with class !(some-class)http://foo.bar/image.jpg!' => 'with class <img src="http://foo.bar/image.jpg" class="some-class" alt="" />',
'with style !{width:100px;height100px}http://foo.bar/image.jpg!' => 'with style <img src="http://foo.bar/image.jpg" style="width:100px;height100px;" alt="" />',
}
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
end
def test_textile_external_links
to_test = {
'This is a "link":http://foo.bar' => 'This is a <a href="http://foo.bar" class="external">link</a>',
'This is an intern "link":/foo/bar' => 'This is an intern <a href="/foo/bar">link</a>',
'"link (Link title)":http://foo.bar' => '<a href="http://foo.bar" title="Link title" class="external">link</a>'