fix bug where relative images in previews did not render
This commit is contained in:
@@ -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>}
|
||||
|
||||
Reference in New Issue
Block a user