From b51d40fe38f4f508edd03323b1d3dc30bc9931e3 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Thu, 17 Mar 2022 03:55:24 +0000 Subject: 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 --- .../wiki_formatting/textile_formatter_test.rb | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test/unit/lib/redmine') 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 + + Hello world. + + Foo + +
+      This is a code block.
+      

+ +

+
+ STR + expected = <<~EXPECTED +

Hello world.

+ +

Foo

+ +
+      This is a code block.
+      <p>
+      <!-- comments in a code block should be preserved -->
+      </p>
+      
+ + 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) -- cgit v1.2.3