From c8066879dba81f5ff5702f7c877d70e93c748431 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 17 Dec 2011 11:23:26 +0000 Subject: [PATCH] Moved wiki links tests together. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8254 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/unit/helpers/application_helper_test.rb | 94 ++++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 7482e75b5..07038567a 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -486,6 +486,53 @@ RAW to_test.each { |text, result| assert_equal "

#{result}

", textilizable(text, :wiki_links => :local) } 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_wiki_links_anchor_option_should_prepend_page_title_to_href + + to_test = { + # link to a page + '[[CookBook documentation]]' => 'CookBook documentation', + '[[CookBook documentation|documentation]]' => 'documentation', + '[[CookBook documentation#One-section]]' => 'CookBook documentation', + '[[CookBook documentation#One-section|documentation]]' => 'documentation', + # 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(text, :wiki_links => :anchor) } + end + def test_html_tags to_test = { "
content
" => "

<div>content</div>

", @@ -654,53 +701,6 @@ 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_wiki_links_anchor_option_should_prepend_page_title_to_href - - to_test = { - # link to a page - '[[CookBook documentation]]' => 'CookBook documentation', - '[[CookBook documentation|documentation]]' => 'documentation', - '[[CookBook documentation#One-section]]' => 'CookBook documentation', - '[[CookBook documentation#One-section|documentation]]' => 'documentation', - # 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(text, :wiki_links => :anchor) } - end - def test_headings_in_wiki_single_page_export_should_be_prepended_with_page_title page = WikiPage.generate!( :title => 'Page Title' ) content = WikiContent.generate!( :text => 'h1. Some heading', :page => page )