diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index aa2c6277..6d46aedf 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -602,111 +602,6 @@ RAW assert textilizable(raw).gsub("\n", "").include?(expected) end - def test_blockquote - # orig raw text - raw = <<-RAW -John said: -> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero. -> Nullam commodo metus accumsan nulla. Curabitur lobortis dui id dolor. -> * Donec odio lorem, -> * sagittis ac, -> * malesuada in, -> * adipiscing eu, dolor. -> -> >Nulla varius pulvinar diam. Proin id arcu id lorem scelerisque condimentum. Proin vehicula turpis vitae lacus. -> Proin a tellus. Nam vel neque. - -He's right. -RAW - - # expected html - expected = <<-EXPECTED -
John said:
--Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero. -Nullam commodo metus accumsan nulla. Curabitur lobortis dui id dolor. ---
-- Donec odio lorem,
-- sagittis ac,
-- malesuada in,
-- adipiscing eu, dolor.
---Nulla varius pulvinar diam. Proin id arcu id lorem scelerisque condimentum. Proin vehicula turpis vitae lacus.
-Proin a tellus. Nam vel neque.
-
He's right.
-EXPECTED - - assert_equal expected.gsub(%r{\s+}, ''), textilizable(raw).gsub(%r{\s+}, '') - end - - def test_table - raw = <<-RAW -This is a table with empty cells: - -|cell11|cell12|| -|cell21||cell23| -|cell31|cell32|cell33| -RAW - - expected = <<-EXPECTED -This is a table with empty cells:
- -cell11 | cell12 | |
cell21 | cell23 | |
cell31 | cell32 | cell33 |
This is a table with line breaks:
- -cell11 continued |
- cell12 | -- |
- | cell23 cell23 line2 cell23 line3 |
- |
cell31 | -cell32 cell32 line2 |
- cell33 | -
[msg1][msg2]
', textilizable('[msg1][msg2]') - end - def test_default_formatter Setting.text_formatting = 'unknown' text = 'a *link*: http://www.example.net/' 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 69b410e8..a221b6c8 100644 --- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb @@ -92,6 +92,111 @@ class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase ) end + def test_blockquote + # orig raw text + raw = <<-RAW +John said: +> Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero. +> Nullam commodo metus accumsan nulla. Curabitur lobortis dui id dolor. +> * Donec odio lorem, +> * sagittis ac, +> * malesuada in, +> * adipiscing eu, dolor. +> +> >Nulla varius pulvinar diam. Proin id arcu id lorem scelerisque condimentum. Proin vehicula turpis vitae lacus. +> Proin a tellus. Nam vel neque. + +He's right. +RAW + + # expected html + expected = <<-EXPECTED +John said:
++Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sed libero. +Nullam commodo metus accumsan nulla. Curabitur lobortis dui id dolor. +++
+- Donec odio lorem,
+- sagittis ac,
+- malesuada in,
+- adipiscing eu, dolor.
+++Nulla varius pulvinar diam. Proin id arcu id lorem scelerisque condimentum. Proin vehicula turpis vitae lacus.
+Proin a tellus. Nam vel neque.
+
He's right.
+EXPECTED + + assert_equal expected.gsub(%r{\s+}, ''), to_html(raw).gsub(%r{\s+}, '') + end + + def test_table + raw = <<-RAW +This is a table with empty cells: + +|cell11|cell12|| +|cell21||cell23| +|cell31|cell32|cell33| +RAW + + expected = <<-EXPECTED +This is a table with empty cells:
+ +cell11 | cell12 | |
cell21 | cell23 | |
cell31 | cell32 | cell33 |
This is a table with line breaks:
+ +cell11 continued |
+ cell12 | ++ |
+ | cell23 cell23 line2 cell23 line3 |
+ |
cell31 | +cell32 cell32 line2 |
+ cell33 | +
[msg1][msg2]
', to_html('[msg1][msg2]') + end + private def assert_html_output(to_test, expect_paragraph = true) @@ -99,4 +204,8 @@ class Redmine::WikiFormatting::TextileFormatterTest < HelperTestCase assert_equal(( expect_paragraph ? "#{expected}
" : expected ), @formatter.new(text).to_html, "Formatting the following text failed:\n===\n#{text}\n===\n") end end + + def to_html(text) + @formatter.new(text).to_html + end end