test/test_parser.rb in sanitize-4.6.6 vs test/test_parser.rb in sanitize-5.0.0
- old
+ new
@@ -17,45 +17,16 @@
Sanitize.fragment("<div>foo\n\n<p>bar</p><div>\nbaz</div></div><div>quux</div>", :elements => ['div', 'p'])
.must_equal "<div>foo\n\n<p>bar</p><div>\nbaz</div></div><div>quux</div>"
end
it 'should not have the Nokogiri 1.4.2+ unterminated script/style element bug' do
- Sanitize.fragment('foo <script>bar').must_equal 'foo bar'
- Sanitize.fragment('foo <style>bar').must_equal 'foo bar'
+ Sanitize.fragment('foo <script>bar').must_equal 'foo '
+ Sanitize.fragment('foo <style>bar').must_equal 'foo '
end
it 'ambiguous non-tag brackets like "1 > 2 and 2 < 1" should be parsed correctly' do
Sanitize.fragment('1 > 2 and 2 < 1').must_equal '1 > 2 and 2 < 1'
Sanitize.fragment('OMG HAPPY BIRTHDAY! *<:-D').must_equal 'OMG HAPPY BIRTHDAY! *<:-D'
- end
-
- # https://github.com/sparklemotion/nokogiri/issues/1008
- it 'should work around the libxml2 content-type meta tag bug' do
- Sanitize.document('<html><head></head><body>Howdy!</body></html>',
- :elements => %w[html head body]
- ).must_equal "<html><head></head><body>Howdy!</body></html>\n"
-
- Sanitize.document('<html><head></head><body>Howdy!</body></html>',
- :elements => %w[html head meta body]
- ).must_equal "<html><head></head><body>Howdy!</body></html>\n"
-
- Sanitize.document('<html><head><meta charset="utf-8"></head><body>Howdy!</body></html>',
- :elements => %w[html head meta body],
- :attributes => {'meta' => ['charset']}
- ).must_equal "<html><head><meta charset=\"utf-8\"></head><body>Howdy!</body></html>\n"
-
- Sanitize.document('<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8"></head><body>Howdy!</body></html>',
- :elements => %w[html head meta body],
- :attributes => {'meta' => %w[charset content http-equiv]}
- ).must_equal "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\"></head><body>Howdy!</body></html>\n"
-
- # Edge case: an existing content-type meta tag with a non-UTF-8 content type
- # will be converted to UTF-8, since that's the only output encoding we
- # support.
- Sanitize.document('<html><head><meta http-equiv="content-type" content="text/html;charset=us-ascii"></head><body>Howdy!</body></html>',
- :elements => %w[html head meta body],
- :attributes => {'meta' => %w[charset content http-equiv]}
- ).must_equal "<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"></head><body>Howdy!</body></html>\n"
end
describe 'when siblings are added after a node during traversal' do
it 'the added siblings should be traversed' do
html = %[