Tests for Rev 171
One test is still broken. Will fix.
This commit is contained in:
parent
0eb723e125
commit
402de89abf
2 changed files with 13 additions and 11 deletions
|
@ -102,18 +102,19 @@ class StubUrlGenerator < AbstractUrlGenerator
|
|||
super(:doesnt_need_controller)
|
||||
end
|
||||
|
||||
def file_link(mode, name, text, web_name, known_file)
|
||||
def file_link(mode, name, text, web_name, known_file, description)
|
||||
title = CGI::escapeHTML(CGI::unescapeHTML( description || text))
|
||||
link = CGI.escape(name)
|
||||
case mode
|
||||
when :export
|
||||
if known_file then %{<a class="existingWikiWord" href="#{link}.html">#{text}</a>}
|
||||
if known_file then %{<a class="existingWikiWord" title="#{title}" href="#{link}.html">#{text}</a>}
|
||||
else %{<span class="newWikiWord">#{text}</span>} end
|
||||
when :publish
|
||||
if known_file then %{<a class="existingWikiWord" href="../published/#{link}">#{text}</a>}
|
||||
if known_file then %{<a class="existingWikiWord" title="#{title}" href="../published/#{link}">#{text}</a>}
|
||||
else %{<span class=\"newWikiWord\">#{text}</span>} end
|
||||
else
|
||||
if known_file
|
||||
%{<a class=\"existingWikiWord\" href=\"../file/#{link}\">#{text}</a>}
|
||||
%{<a class=\"existingWikiWord\" title="#{title}" href=\"../file/#{link}\">#{text}</a>}
|
||||
else
|
||||
%{<span class=\"newWikiWord\">#{text}<a href=\"../file/#{link}\">?</a></span>}
|
||||
end
|
||||
|
@ -142,17 +143,18 @@ class StubUrlGenerator < AbstractUrlGenerator
|
|||
end
|
||||
end
|
||||
|
||||
def pic_link(mode, name, text, web_name, known_pic)
|
||||
def pic_link(mode, name, text, web_name, known_pic, description)
|
||||
alt_text = CGI::escapeHTML(CGI::unescapeHTML( description || text))
|
||||
link = CGI.escape(name)
|
||||
case mode.to_sym
|
||||
when :export
|
||||
if known_pic then %{<img alt="#{text}" src="#{link}" />}
|
||||
if known_pic then %{<img alt="#{alt_text}" src="#{link}" />}
|
||||
else %{<img alt="#{text}" src="no image" />} end
|
||||
when :publish
|
||||
if known_pic then %{<img alt="#{text}" src="#{link}" />}
|
||||
if known_pic then %{<img alt="#{alt_text}" src="#{link}" />}
|
||||
else %{<span class="newWikiWord">#{text}</span>} end
|
||||
else
|
||||
if known_pic then %{<img alt="#{text}" src="../file/#{link}" />}
|
||||
if known_pic then %{<img alt="#{alt_text}" src="../file/#{link}" />}
|
||||
else %{<span class="newWikiWord">#{text}<a href="../file/#{link}">?</a></span>} end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -305,10 +305,10 @@ class PageRendererTest < Test::Unit::TestCase
|
|||
FileUtils.rm_rf("#{RAILS_ROOT}/public/wiki1/files/*")
|
||||
@web.wiki_files.create(:file_name => 'square.jpg', :description => 'Square', :content => 'never mind')
|
||||
assert_markup_parsed_as(
|
||||
'<p><img alt="Square" src="../file/square.jpg" /></p>',
|
||||
'[[square.jpg|Square:pic]]')
|
||||
'<p><img alt="Blue Square" src="../file/square.jpg" /></p>',
|
||||
'[[square.jpg|Blue Square:pic]]')
|
||||
assert_markup_parsed_as(
|
||||
'<p><img alt="square.jpg" src="../file/square.jpg" /></p>',
|
||||
'<p><img alt="Square" src="../file/square.jpg" /></p>',
|
||||
'[[square.jpg:pic]]')
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue