summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorEtienne Massip <etienne.massip@gmail.com>2011-10-02 14:44:07 +0000
committerEtienne Massip <etienne.massip@gmail.com>2011-10-02 14:44:07 +0000
commit1ee65e046913ede620c7dd989081bb61d8a8c198 (patch)
tree11610ffb66f439d3fafdbff960538e726cd645a2 /test
parente2f57b5874957261992a690eb1eae3c70cde69ac (diff)
downloadredmine-1ee65e046913ede620c7dd989081bb61d8a8c198.tar.gz
redmine-1ee65e046913ede620c7dd989081bb61d8a8c198.zip
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
Diffstat (limited to 'test')
-rw-r--r--test/unit/helpers/application_helper_test.rb27
1 files changed, 27 insertions, 0 deletions
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]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation" class="wiki-page">CookBook documentation</a>',
+ '[[CookBook documentation|documentation]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation" class="wiki-page">documentation</a>',
+ '[[CookBook documentation#One-section]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation#One-section" class="wiki-page">CookBook documentation</a>',
+ '[[CookBook documentation#One-section|documentation]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation#One-section" class="wiki-page">documentation</a>',
+ # link to the current page
+ '[[Another page]]' => '<a href="/projects/ecookbook/wiki/Another_page" class="wiki-page">Another page</a>',
+ '[[Another page|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page" class="wiki-page">Page</a>',
+ '[[Another page#anchor]]' => '<a href="#anchor" class="wiki-page">Another page</a>',
+ '[[Another page#anchor|Page]]' => '<a href="#anchor" class="wiki-page">Page</a>',
+ # page that doesn't exist
+ '[[Unknown page]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">Unknown page</a>',
+ '[[Unknown page|404]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">404</a>',
+ '[[Unknown page#anchor]]' => '<a href="/projects/ecookbook/wiki/Unknown_page#anchor" class="wiki-page new">Unknown page</a>',
+ '[[Unknown page#anchor|404]]' => '<a href="/projects/ecookbook/wiki/Unknown_page#anchor" class="wiki-page new">404</a>',
+ }
+
+ @project = Project.find(1)
+
+ to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(WikiContent.generate!( :text => text, :page => page ), :text) }
+ end
+
def test_table_of_content
raw = <<-RAW
{{toc}}