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