test/scrubbers_test.rb in rails-html-sanitizer-1.0.2 vs test/scrubbers_test.rb in rails-html-sanitizer-1.0.3

- old
+ new

@@ -141,10 +141,24 @@ html = '<tag remove="" other=""></tag><a remove="" other=""></a>' assert_scrubbed html, '<a other=""></a>' end end +class TextOnlyScrubberTest < ScrubberTest + def setup + @scrubber = Rails::Html::TextOnlyScrubber.new + end + + def test_removes_all_tags_and_keep_the_content + assert_scrubbed '<tag>hello</tag>', 'hello' + end + + def test_skips_text_nodes + assert_node_skipped('some text') + end +end + class ReturningStopFromScrubNodeTest < ScrubberTest class ScrubStopper < Rails::Html::PermitScrubber def scrub_node(node) Loofah::Scrubber::STOP end @@ -155,6 +169,6 @@ end def test_returns_stop_from_scrub_if_scrub_node_does assert_scrub_stopped '<script>remove me</script>' end -end \ No newline at end of file +end