summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2019-08-24 07:03:01 +0000
committerGo MAEDA <maeda@farend.jp>2019-08-24 07:03:01 +0000
commit878f4c3455141a26d7070fb0efac1cd89243c3bb (patch)
treee66dcd770be451a9c8ae19db4c5d7c191e134eb6 /test
parentd50f0e83fb6a72713f6980799ace312a9bc05e4c (diff)
downloadredmine-878f4c3455141a26d7070fb0efac1cd89243c3bb.tar.gz
redmine-878f4c3455141a26d7070fb0efac1cd89243c3bb.zip
Add tests for r18383 (#31231).
Patch by Mizuki ISHIKAWA. git-svn-id: http://svn.redmine.org/redmine/trunk@18384 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/lib/redmine/wiki_formatting/html_parser_test.rb18
-rw-r--r--test/unit/lib/redmine/wiki_formatting/markdown_html_parser_test.rb5
-rw-r--r--test/unit/lib/redmine/wiki_formatting/textile_html_parser_test.rb5
3 files changed, 28 insertions, 0 deletions
diff --git a/test/unit/lib/redmine/wiki_formatting/html_parser_test.rb b/test/unit/lib/redmine/wiki_formatting/html_parser_test.rb
index 210bba832..3d931bb3c 100644
--- a/test/unit/lib/redmine/wiki_formatting/html_parser_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/html_parser_test.rb
@@ -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
diff --git a/test/unit/lib/redmine/wiki_formatting/markdown_html_parser_test.rb b/test/unit/lib/redmine/wiki_formatting/markdown_html_parser_test.rb
index 6a4b77387..45a5a52f9 100644
--- a/test/unit/lib/redmine/wiki_formatting/markdown_html_parser_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/markdown_html_parser_test.rb
@@ -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
diff --git a/test/unit/lib/redmine/wiki_formatting/textile_html_parser_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_html_parser_test.rb
index a338ed528..86d7e66d2 100644
--- a/test/unit/lib/redmine/wiki_formatting/textile_html_parser_test.rb
+++ b/test/unit/lib/redmine/wiki_formatting/textile_html_parser_test.rb
@@ -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