Add test for #542
This commit is contained in:
@@ -407,6 +407,12 @@ module Gollum
|
||||
presence = "present"
|
||||
end
|
||||
link = ::File.join(@wiki.base_path, page ? page.escaped_url_path : CGI.escape(link_name))
|
||||
|
||||
# //page is invalid
|
||||
# strip all duplicate forward slashes using helpers.rb clean_url
|
||||
# //page => /page
|
||||
# link = one_leading_slash link
|
||||
|
||||
%{<a class="internal #{presence}" href="#{link}#{extra}">#{name}</a>}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -55,6 +55,22 @@ context "Markup" do
|
||||
#
|
||||
#########################################################################
|
||||
|
||||
test "absolute link to non-existant page" do
|
||||
@wiki.write_page("linktest", :markdown, "[[/page]]", commit_details)
|
||||
|
||||
# "<p>a <a class=\"internal absent\" href=\"/Foo\">Foo</a><a class=\"internal absent\" href=\"/Bar\">Bar</a> b</p>"
|
||||
page = @wiki.page("linktest")
|
||||
doc = Nokogiri::HTML page.formatted_data
|
||||
paras = doc / :p
|
||||
para = paras.first
|
||||
anchors = para / :a
|
||||
assert_equal 1, paras.size
|
||||
assert_equal 1, anchors.size
|
||||
assert_equal 'internal absent', anchors[0]['class']
|
||||
assert_equal '/Page', anchors[0]['href']
|
||||
assert_equal 'Page', anchors[0].text
|
||||
end
|
||||
|
||||
test "double page links no space" do
|
||||
@wiki.write_page("Bilbo Baggins", :markdown, "a [[Foo]][[Bar]] b", commit_details)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user