summaryrefslogtreecommitdiffstats
path: root/test/unit/lib/redmine
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2022-03-17 03:55:24 +0000
committerGo MAEDA <maeda@farend.jp>2022-03-17 03:55:24 +0000
commitb51d40fe38f4f508edd03323b1d3dc30bc9931e3 (patch)
tree6b5aecd21f6a9cde397f1fca9270aee49ff10622 /test/unit/lib/redmine
parent2d6f552599d0e632953372b7a942a5eaab099631 (diff)
downloadredmine-b51d40fe38f4f508edd03323b1d3dc30bc9931e3.tar.gz
redmine-b51d40fe38f4f508edd03323b1d3dc30bc9931e3.zip
Comments for Textile text formatting (#20511).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@21457 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/lib/redmine')
-rw-r--r--test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb32
1 files changed, 32 insertions, 0 deletions
diff --git a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
index 8d9f4ce04..30013b837 100644
--- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb
@@ -719,6 +719,38 @@ class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase
assert_equal expected.gsub(%r{[\r\n\t]}, ''), to_html(text).gsub(%r{[\r\n\t]}, '')
end
+ def test_should_remove_html_comments
+ text = <<~STR
+ <!-- begin -->
+ Hello <!-- comment between words -->world.
+
+ <!--
+ multi-line
+ comment -->Foo
+
+ <pre>
+ This is a code block.
+ <p>
+ <!-- comments in a code block should be preserved -->
+ </p>
+ </pre>
+ STR
+ expected = <<~EXPECTED
+ <p>Hello world.</p>
+
+ <p>Foo</p>
+
+ <pre>
+ This is a code block.
+ &lt;p&gt;
+ &lt;!-- comments in a code block should be preserved --&gt;
+ &lt;/p&gt;
+ </pre>
+
+ EXPECTED
+ assert_equal expected.gsub(%r{[\r\n\t]}, ''), to_html(text).gsub(%r{[\r\n\t]}, '')
+ end
+
private
def assert_html_output(to_test, expect_paragraph = true)