]> git.openstreetmap.org Git - rails.git/blobdiff - test/lib/rich_text_test.rb
Bump eslint from 8.28.0 to 8.29.0
[rails.git] / test / lib / rich_text_test.rb
index 5b590bc3e41ae1a60253884ff1154622af7c436e..9d00d658d5bac697b3e4a8bce6e4bfb01fc52469 100644 (file)
@@ -58,6 +58,12 @@ class RichTextTest < ActiveSupport::TestCase
       assert_select "p[class='btn btn-warning']", false
       assert_select "p", /^Click Me$/
     end
+
+    r = RichText.new("html", "<p style='color:red'>Danger</p>")
+    assert_html r do
+      assert_select "p[style='color:red']", false
+      assert_select "p", /^Danger$/
+    end
   end
 
   def test_html_to_text
@@ -163,11 +169,16 @@ class RichTextTest < ActiveSupport::TestCase
     end
 
     r = RichText.new("markdown", "Click Me\n{:.btn.btn-warning}")
-    # raise r.to_html
     assert_html r do
       assert_select "p[class='btn btn-warning']", false
       assert_select "p", /^Click Me$/
     end
+
+    r = RichText.new("markdown", "<p style='color:red'>Danger</p>")
+    assert_html r do
+      assert_select "p[style='color:red']", false
+      assert_select "p", /^Danger$/
+    end
   end
 
   def test_markdown_to_text
@@ -213,7 +224,7 @@ class RichTextTest < ActiveSupport::TestCase
 
   def assert_html(richtext, &block)
     html = richtext.to_html
-    assert html.html_safe?
+    assert_predicate html, :html_safe?
     root = Nokogiri::HTML::DocumentFragment.parse(html)
     assert_select root, "*" do
       yield block