Rails4: replace hard-coded html with class at ApplicationHelperTest#test_wiki_links_anchor_option_should_prepend_page_title_to_href

See r12784 comment.

git-svn-id: http://svn.redmine.org/redmine/trunk@12823 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2014-02-05 08:56:35 +00:00
parent 936052f9f6
commit 325b3db186
1 changed files with 35 additions and 12 deletions

View File

@ -706,23 +706,46 @@ RAW
end end
def test_wiki_links_anchor_option_should_prepend_page_title_to_href def test_wiki_links_anchor_option_should_prepend_page_title_to_href
to_test = { to_test = {
# link to a page # link to a page
'[[CookBook documentation]]' => '<a href="#CookBook_documentation" class="wiki-page">CookBook documentation</a>', '[[CookBook documentation]]' =>
'[[CookBook documentation|documentation]]' => '<a href="#CookBook_documentation" class="wiki-page">documentation</a>', link_to("CookBook documentation",
'[[CookBook documentation#One-section]]' => '<a href="#CookBook_documentation_One-section" class="wiki-page">CookBook documentation</a>', "#CookBook_documentation",
'[[CookBook documentation#One-section|documentation]]' => '<a href="#CookBook_documentation_One-section" class="wiki-page">documentation</a>', :class => "wiki-page"),
'[[CookBook documentation|documentation]]' =>
link_to("documentation",
"#CookBook_documentation",
:class => "wiki-page"),
'[[CookBook documentation#One-section]]' =>
link_to("CookBook documentation",
"#CookBook_documentation_One-section",
:class => "wiki-page"),
'[[CookBook documentation#One-section|documentation]]' =>
link_to("documentation",
"#CookBook_documentation_One-section",
:class => "wiki-page"),
# page that doesn't exist # page that doesn't exist
'[[Unknown page]]' => '<a href="#Unknown_page" class="wiki-page new">Unknown page</a>', '[[Unknown page]]' =>
'[[Unknown page|404]]' => '<a href="#Unknown_page" class="wiki-page new">404</a>', link_to("Unknown page",
'[[Unknown page#anchor]]' => '<a href="#Unknown_page_anchor" class="wiki-page new">Unknown page</a>', "#Unknown_page",
'[[Unknown page#anchor|404]]' => '<a href="#Unknown_page_anchor" class="wiki-page new">404</a>', :class => "wiki-page new"),
'[[Unknown page|404]]' =>
link_to("404",
"#Unknown_page",
:class => "wiki-page new"),
'[[Unknown page#anchor]]' =>
link_to("Unknown page",
"#Unknown_page_anchor",
:class => "wiki-page new"),
'[[Unknown page#anchor|404]]' =>
link_to("404",
"#Unknown_page_anchor",
:class => "wiki-page new"),
} }
@project = Project.find(1) @project = Project.find(1)
to_test.each do |text, result|
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text, :wiki_links => :anchor) } assert_equal "<p>#{result}</p>", textilizable(text, :wiki_links => :anchor)
end
end end
def test_html_tags def test_html_tags