From 1ee65e046913ede620c7dd989081bb61d8a8c198 Mon Sep 17 00:00:00 2001 From: Etienne Massip Date: Sun, 2 Oct 2011 14:44:07 +0000 Subject: Use local links in wiki pages when possible (#3276). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7558 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/helpers/application_helper_test.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'test') diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index f71dfbe43..e3e788da2 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -533,6 +533,33 @@ EXPECTED assert_equal expected, textilizable(raw) end + def test_wiki_links_within_wiki_page_context + + page = WikiPage.find_by_title('Another_page' ) + + to_test = { + # link to another page + '[[CookBook documentation]]' => 'CookBook documentation', + '[[CookBook documentation|documentation]]' => 'documentation', + '[[CookBook documentation#One-section]]' => 'CookBook documentation', + '[[CookBook documentation#One-section|documentation]]' => 'documentation', + # link to the current page + '[[Another page]]' => 'Another page', + '[[Another page|Page]]' => 'Page', + '[[Another page#anchor]]' => 'Another page', + '[[Another page#anchor|Page]]' => 'Page', + # page that doesn't exist + '[[Unknown page]]' => 'Unknown page', + '[[Unknown page|404]]' => '404', + '[[Unknown page#anchor]]' => 'Unknown page', + '[[Unknown page#anchor|404]]' => '404', + } + + @project = Project.find(1) + + to_test.each { |text, result| assert_equal "

#{result}

", textilizable(WikiContent.generate!( :text => text, :page => page ), :text) } + end + def test_table_of_content raw = <<-RAW {{toc}} -- cgit v1.2.3