fix bug where relative images in previews did not render

This commit is contained in:
rick
2011-01-27 16:34:29 -08:00
parent f708dc7002
commit 732e8a9361
3 changed files with 27 additions and 6 deletions
+21
View File
@@ -238,6 +238,27 @@ context "Markup" do
assert_equal %{<p>a <img src="/wiki/greek/alpha.jpg" /><a href="/wiki/greek/alpha.jpg">a</a> b</p>}, output
end
test "image with absolute path on a preview" do
@wiki = Gollum::Wiki.new(@path, :base_path => '/wiki')
index = @wiki.repo.index
index.add("alpha.jpg", "hi")
index.commit("Add alpha.jpg")
page = @wiki.preview_page("Test", "a [[/alpha.jpg]] b", :markdown)
assert_equal %{<p>a <img src="/wiki/alpha.jpg" /> b</p>}, page.formatted_data
end
test "image with relative path on a preview" do
@wiki = Gollum::Wiki.new(@path, :base_path => '/wiki')
index = @wiki.repo.index
index.add("alpha.jpg", "hi")
index.add("greek/alpha.jpg", "hi")
index.commit("Add alpha.jpg")
page = @wiki.preview_page("Test", "a [[alpha.jpg]] [[greek/alpha.jpg]] b", :markdown)
assert_equal %{<p>a <img src="/wiki/alpha.jpg" /><img src="/wiki/greek/alpha.jpg" /> b</p>}, page.formatted_data
end
test "image with alt" do
content = "a [[alpha.jpg|alt=Alpha Dog]] b"
output = %{<p>a <img src="/greek/alpha.jpg" alt="Alpha Dog" /> b</p>}