Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding some sample specs to try to determine how we should handle edg…

…e cases for fragments.
  • Loading branch information...
commit d0f0b6bbd0ec0a04750b3b13b450de3c51e02a38 1 parent 886887b
@flavorjones flavorjones authored
Showing with 12 additions and 4 deletions.
  1. +12 −4 test/test_basic.rb
View
16 test/test_basic.rb
@@ -10,10 +10,6 @@ def test_empty_string
assert_equal "", Dryopteris.sanitize("")
end
- # def test_preserve_whitespace
- # assert_equal "<b>Foo</b>\n<i>Bar</i>", Dryopteris.sanitize("<b>Foo</b>\n<i>Bar</i>")
- # end
-
def test_removal_of_illegal_tag
html = <<-HTML
following this there should be no jim tag
@@ -51,4 +47,16 @@ def test_css_sanitization
assert_no_match(/foo\.com/, sane.inner_html)
end
+ def test_fragment_with_no_tags
+ assert_equal "This fragment has no tags.", Dryopteris.sanitize("This fragment has no tags.")
+ end
+
+ def test_fragment_in_p_tag
+ assert_equal "<p>This fragment is in a p.</p>", Dryopteris.sanitize("<p>This fragment is in a p.</p>")
+ end
+
+ def test_fragment_in_a_nontrivial_p_tag
+ assert_equal "<p>This fragment is in a p.</p>", Dryopteris.sanitize(" \n<p foo='bar'>This fragment is in a p.</p>")
+ end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.