summaryrefslogtreecommitdiffstats
path: root/test/helpers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2018-09-15 09:11:13 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2018-09-15 09:11:13 +0000
commite501cb34819a301704dbe8004a4526e3400959be (patch)
tree224639efb1cafe4562c089bb532dc187f78e1f0c /test/helpers
parent04c8246b23db860d1d2d46acff2c64dc17f1e6ce (diff)
downloadredmine-e501cb34819a301704dbe8004a4526e3400959be.tar.gz
redmine-e501cb34819a301704dbe8004a4526e3400959be.zip
Special character like quote breaks wiki links (#22967).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@17490 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/helpers')
-rw-r--r--test/helpers/application_helper_test.rb46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb
index 0a4c32077..fd0886c80 100644
--- a/test/helpers/application_helper_test.rb
+++ b/test/helpers/application_helper_test.rb
@@ -822,6 +822,25 @@ RAW
to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
end
+ def test_wiki_links_with_special_characters_should_work_in_textile
+ to_test = wiki_links_with_special_characters
+
+ @project = Project.find(1)
+ with_settings :text_formatting => 'textile' do
+ to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) }
+ end
+ end
+
+ def test_wiki_links_with_special_characters_should_work_in_markdown
+ to_test = wiki_links_with_special_characters
+
+ @project = Project.find(1)
+ with_settings :text_formatting => 'markdown' do
+ to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text).strip }
+ end
+ end
+
+
def test_wiki_links_within_local_file_generation_context
to_test = {
# link to a page
@@ -1723,6 +1742,33 @@ RAW
assert_equal '<span class="hours hours-int">0</span><span class="hours hours-dec">.75</span>', html_hours('0.75')
end
+ private
+
+ def wiki_links_with_special_characters
+ return {
+ '[[Jack & Coke]]' =>
+ link_to("Jack & Coke",
+ "/projects/ecookbook/wiki/Jack_&_Coke",
+ :class => "wiki-page new"),
+ '[[a "quoted" name]]' =>
+ link_to("a \"quoted\" name",
+ "/projects/ecookbook/wiki/A_%22quoted%22_name",
+ :class => "wiki-page new"),
+ '[[le français, c\'est super]]' =>
+ link_to("le français, c\'est super",
+ "/projects/ecookbook/wiki/Le_fran%C3%A7ais_c'est_super",
+ :class => "wiki-page new"),
+ '[[broken < less]]' =>
+ link_to("broken < less",
+ "/projects/ecookbook/wiki/Broken_%3C_less",
+ :class => "wiki-page new"),
+ '[[broken > more]]' =>
+ link_to("broken > more",
+ "/projects/ecookbook/wiki/Broken_%3E_more",
+ :class => "wiki-page new"),
+ }
+ end
+
def test_export_csv_encoding_select_tag_should_return_nil_when_general_csv_encoding_is_UTF8
with_locale 'az' do
assert_equal l(:general_csv_encoding), 'UTF-8'