]> source.dussan.org Git - redmine.git/commitdiff
Add tests for r18383 (#31231).
authorGo MAEDA <maeda@farend.jp>
Sat, 24 Aug 2019 07:03:01 +0000 (07:03 +0000)
committerGo MAEDA <maeda@farend.jp>
Sat, 24 Aug 2019 07:03:01 +0000 (07:03 +0000)
Patch by Mizuki ISHIKAWA.

git-svn-id: http://svn.redmine.org/redmine/trunk@18384 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/lib/redmine/wiki_formatting/html_parser_test.rb
test/unit/lib/redmine/wiki_formatting/markdown_html_parser_test.rb
test/unit/lib/redmine/wiki_formatting/textile_html_parser_test.rb

index 210bba8325ef96841dd41478816faf8f13a0ff5d..3d931bb3c64e0bf4b9838aab692ffef4958b0178 100644 (file)
@@ -46,4 +46,22 @@ class Redmine::WikiFormatting::HtmlParserTest < ActiveSupport::TestCase
       assert_equal expected, @parser.to_text(html)
     end
   end
+
+  def test_should_remove_space_of_beginning_of_line
+    str = <<~HTML
+      <table>
+        <tr>
+          <th>th1</th>
+          <th>th2</th>
+        </tr>
+        <tr>
+          <td>td1</td>
+          <td>td2</td>
+        </tr>
+      </table>
+    HTML
+
+    assert_equal "th1\n\nth2\n\ntd1\n\ntd2",
+      @parser.to_text(str)
+  end
 end
index 6a4b77387cbe116f316d4b9f0951afaa1a5b49be..45a5a52f9949a640026fab9b9c8cf6ce1ebc720b 100644 (file)
@@ -34,4 +34,9 @@ class Redmine::WikiFormatting::MarkdownHtmlParserTest < ActiveSupport::TestCase
     assert_equal 'foo http://example.com/ baz',
       @parser.to_text('foo<a href="http://example.com/"></a>baz')
   end
+
+  def test_html_tables_conversion
+    assert_equal "*th1*\n*th2*\n\ntd1\ntd2",
+      @parser.to_text('<table><tr><th>th1</th><th>th2</th></tr><tr><td>td1</td><td>td2</td></tr></table>')
+  end
 end
index a338ed528b6cbec7c6277eb6226228f81715ba83..86d7e66d291f628d51e9e1534d930d0766ac0e37 100644 (file)
@@ -34,4 +34,9 @@ class Redmine::WikiFormatting::TextileHtmlParserTest < ActiveSupport::TestCase
     assert_equal 'foo http://example.com/ baz',
       @parser.to_text('foo<a href="http://example.com/"></a>baz')
   end
+
+  def test_html_tables_conversion
+    assert_equal "*th1*\n*th2*\n\ntd1\ntd2",
+      @parser.to_text('<table><tr><th>th1</th><th>th2</th></tr><tr><td>td1</td><td>td2</td></tr></table>')
+  end
 end