test/test_sanitize.rb in sanitize-4.6.6 vs test/test_sanitize.rb in sanitize-5.0.0

- old
+ new

@@ -23,28 +23,28 @@ @s = Sanitize.new(:elements => ['html']) end it 'should sanitize an HTML document' do @s.document('<!doctype html><html><b>Lo<!-- comment -->rem</b> <a href="pants" title="foo">ipsum</a> <a href="http://foo.com/"><strong>dolor</strong></a> sit<br/>amet <script>alert("hello world");</script></html>') - .must_equal "<html>Lorem ipsum dolor sit amet alert(\"hello world\");</html>\n" + .must_equal "<html>Lorem ipsum dolor sit amet </html>" end it 'should not modify the input string' do input = '<!DOCTYPE html><b>foo</b>' @s.document(input) input.must_equal('<!DOCTYPE html><b>foo</b>') end it 'should not choke on frozen documents' do - @s.document('<!doctype html><html><b>foo</b>'.freeze).must_equal "<html>foo</html>\n" + @s.document('<!doctype html><html><b>foo</b>'.freeze).must_equal "<html>foo</html>" end end describe '#fragment' do it 'should sanitize an HTML fragment' do @s.fragment('<b>Lo<!-- comment -->rem</b> <a href="pants" title="foo">ipsum</a> <a href="http://foo.com/"><strong>dolor</strong></a> sit<br/>amet <script>alert("hello world");</script>') - .must_equal 'Lorem ipsum dolor sit amet alert("hello world");' + .must_equal 'Lorem ipsum dolor sit amet ' end it 'should not modify the input string' do input = '<b>foo</b>' @s.fragment(input) @@ -69,10 +69,10 @@ frag = doc.fragment doc.xpath('/html/body/node()').each {|node| frag << node } @s.node!(frag) - frag.to_html.must_equal 'Lorem ipsum dolor sit amet alert("hello world");' + frag.to_html.must_equal 'Lorem ipsum dolor sit amet ' end describe "when the given node is a document and <html> isn't whitelisted" do it 'should raise a Sanitize::Error' do doc = Nokogiri::HTML5.parse('foo')