Sha256: 70da4bfc0b69ccb7fd4018050305d508b99841f324e1f2673ac8b96d134e043e

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 Bytes

Contents

require './test/helper.rb'

require "cssfilter"

class TestCSSFilter < MicroTest::TestCase

  def setup
    @css = <<-END
      * {
        margin: 0;
        height: 0;
      }

      body {
        margin: 0;
        height: 0;
        background: url(http://xzy.org);
      }

      h1 {
        trythis: url(http://here.org/fun.js);
        font-size: 12pt;
      }
    END
    @result = "* {\nmargin: 0;\nheight: 0;\n}\nbody {\nmargin: 0;\nheight: 0;\n}\nh1 {\ntrythis: url(http://here.org/fun.js);\nfont-size: 12pt;\n}"
  end

  def test_filter
    cssfilter = CSSFilter.new(:allowed_hosts=>["here.org"], :strip_whitespace => true)
    csstree   = cssfilter.filter(@css)

    csstree.to_s.assert == @result
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
htmlfilter-1.3.0 test/test_cssfilter.rb
htmlfilter-1.2.1 test/test_cssfilter.rb