test/test_clean_css.rb in sanitize-6.1.3 vs test/test_clean_css.rb in sanitize-7.0.0

- old
+ new

@@ -1,39 +1,40 @@ -# encoding: utf-8 -require_relative 'common' +# frozen_string_literal: true -describe 'Sanitize::Transformers::CSS::CleanAttribute' do +require_relative "common" + +describe "Sanitize::Transformers::CSS::CleanAttribute" do make_my_diffs_pretty! parallelize_me! before do @s = Sanitize.new(Sanitize::Config::RELAXED) end - it 'should sanitize CSS properties in style attributes' do + it "should sanitize CSS properties in style attributes" do _(@s.fragment(%[ <div style="color: #fff; width: expression(alert(1)); /* <-- evil! */"></div> - ].strip)).must_equal %[ + ].strip)).must_equal %( <div style="color: #fff; /* <-- evil! */"></div> - ].strip + ).strip end - it 'should remove the style attribute if the sanitized CSS is empty' do - _(@s.fragment('<div style="width: expression(alert(1))"></div>')). - must_equal '<div></div>' + it "should remove the style attribute if the sanitized CSS is empty" do + _(@s.fragment('<div style="width: expression(alert(1))"></div>')) + .must_equal "<div></div>" end end -describe 'Sanitize::Transformers::CSS::CleanElement' do +describe "Sanitize::Transformers::CSS::CleanElement" do make_my_diffs_pretty! parallelize_me! before do @s = Sanitize.new(Sanitize::Config::RELAXED) end - it 'should sanitize CSS stylesheets in <style> elements' do + it "should sanitize CSS stylesheets in <style> elements" do html = %[ <style>@import url(evil.css); /* Yay CSS! */ .foo { color: #fff; } #bar { background: url(yay.jpg); bogus: wtf; } @@ -59,9 +60,9 @@ } </style> ].strip end - it 'should remove the <style> element if the sanitized CSS is empty' do - _(@s.fragment('<style></style>')).must_equal '' + it "should remove the <style> element if the sanitized CSS is empty" do + _(@s.fragment("<style></style>")).must_equal "" end end