diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 29d2af5b9..f645f1a52 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -644,36 +644,86 @@ RAW def test_wiki_links russian_eacape = CGI.escape(@russian_test) to_test = { - '[[CookBook documentation]]' => 'CookBook documentation', - '[[Another page|Page]]' => 'Page', + '[[CookBook documentation]]' => + link_to("CookBook documentation", + "/projects/ecookbook/wiki/CookBook_documentation", + :class => "wiki-page"), + '[[Another page|Page]]' => + link_to("Page", + "/projects/ecookbook/wiki/Another_page", + :class => "wiki-page"), # title content should be formatted - '[[Another page|With _styled_ *title*]]' => 'With styled title', - '[[Another page|With title containing HTML entities & markups]]' => 'With title containing <strong>HTML entities & markups</strong>', + '[[Another page|With _styled_ *title*]]' => + link_to("With styled title".html_safe, + "/projects/ecookbook/wiki/Another_page", + :class => "wiki-page"), + '[[Another page|With title containing HTML entities & markups]]' => + link_to("With title containing <strong>HTML entities & markups</strong>".html_safe, + "/projects/ecookbook/wiki/Another_page", + :class => "wiki-page"), # link with anchor - '[[CookBook documentation#One-section]]' => 'CookBook documentation', - '[[Another page#anchor|Page]]' => 'Page', + '[[CookBook documentation#One-section]]' => + link_to("CookBook documentation", + "/projects/ecookbook/wiki/CookBook_documentation#One-section", + :class => "wiki-page"), + '[[Another page#anchor|Page]]' => + link_to("Page", + "/projects/ecookbook/wiki/Another_page#anchor", + :class => "wiki-page"), # UTF8 anchor "[[Another_page##{@russian_test}|#{@russian_test}]]" => - %|#{@russian_test}|, + link_to(@russian_test, + "/projects/ecookbook/wiki/Another_page##{russian_eacape}", + :class => "wiki-page"), # page that doesn't exist - '[[Unknown page]]' => 'Unknown page', - '[[Unknown page|404]]' => '404', + '[[Unknown page]]' => + link_to("Unknown page", + "/projects/ecookbook/wiki/Unknown_page", + :class => "wiki-page new"), + '[[Unknown page|404]]' => + link_to("404", + "/projects/ecookbook/wiki/Unknown_page", + :class => "wiki-page new"), # link to another project wiki - '[[onlinestore:]]' => 'onlinestore', - '[[onlinestore:|Wiki]]' => 'Wiki', - '[[onlinestore:Start page]]' => 'Start page', - '[[onlinestore:Start page|Text]]' => 'Text', - '[[onlinestore:Unknown page]]' => 'Unknown page', + '[[onlinestore:]]' => + link_to("onlinestore", + "/projects/onlinestore/wiki", + :class => "wiki-page"), + '[[onlinestore:|Wiki]]' => + link_to("Wiki", + "/projects/onlinestore/wiki", + :class => "wiki-page"), + '[[onlinestore:Start page]]' => + link_to("Start page", + "/projects/onlinestore/wiki/Start_page", + :class => "wiki-page"), + '[[onlinestore:Start page|Text]]' => + link_to("Text", + "/projects/onlinestore/wiki/Start_page", + :class => "wiki-page"), + '[[onlinestore:Unknown page]]' => + link_to("Unknown page", + "/projects/onlinestore/wiki/Unknown_page", + :class => "wiki-page new"), # striked through link - '-[[Another page|Page]]-' => 'Page', - '-[[Another page|Page]] link-' => 'Page link', + '-[[Another page|Page]]-' => + "".html_safe + + link_to("Page", + "/projects/ecookbook/wiki/Another_page", + :class => "wiki-page").html_safe + + "".html_safe, + '-[[Another page|Page]] link-' => + "".html_safe + + link_to("Page", + "/projects/ecookbook/wiki/Another_page", + :class => "wiki-page").html_safe + + " link".html_safe, # escaping '![[Another page|Page]]' => '[[Another page|Page]]', # project does not exist '[[unknowproject:Start]]' => '[[unknowproject:Start]]', '[[unknowproject:Start|Page title]]' => '[[unknowproject:Start|Page title]]', } - @project = Project.find(1) to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text) } end