]> git.openstreetmap.org Git - rails.git/blobdiff - test/lib/rich_text_test.rb
Use first paragraph as richtext description
[rails.git] / test / lib / rich_text_test.rb
index 3e17cac7b6303232f000c8c55e23749dcd7f3811..3536db3989e7ffde8a2f539cc00a051e55eb9c98 100644 (file)
@@ -335,6 +335,21 @@ class RichTextTest < ActiveSupport::TestCase
     assert_nil r.description
   end
 
+  def test_markdown_description
+    r = RichText.new("markdown", "This is an article about something.")
+    assert_equal "This is an article about something.", r.description
+  end
+
+  def test_markdown_description_after_heading
+    r = RichText.new("markdown", "#Heading\n\nHere starts the text.")
+    assert_equal "Here starts the text.", r.description
+  end
+
+  def test_markdown_description_elements
+    r = RichText.new("markdown", "*Something* **important** [here](https://example.com/).")
+    assert_equal "Something important here.", r.description
+  end
+
   private
 
   def assert_html(richtext, &block)