Sha256: 4687dfe6fc196e9e09128cd3a806e009c1a97861992bafda36b2da3c98328e90

Contents?: true

Size: 759 Bytes

Versions: 6

Compression:

Stored size: 759 Bytes

Contents

# encoding: utf-8

class Nanoc::Filters::UglifyJSTest < MiniTest::Unit::TestCase

  include Nanoc::TestHelpers

  def test_filter
    if_have 'uglifier' do
      # Create filter
      filter = ::Nanoc::Filters::UglifyJS.new

      # Run filter
      result = filter.run("foo = 1; (function(bar) { if (true) alert(bar); })(foo)")
      assert_match(/foo=1,function\((.)\){alert\(\1\)}\(foo\);/, result)
    end
  end

  def test_filter_with_options

    if_have 'uglifier' do
      # Create filter
      filter = ::Nanoc::Filters::UglifyJS.new

      # Run filter
      result = filter.run("foo = 1; (function(bar) { if (true) alert(bar); })(foo)", :toplevel => true)
      assert_match(/foo=1,function\((.)\){alert\(\1\)}\(foo\);/, result)
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nanoc-3.5.0 test/filters/test_uglify_js.rb
nanoc-3.5.0b2 test/filters/test_uglify_js.rb
nanoc-3.5.0b1 test/filters/test_uglify_js.rb
nanoc-3.4.3 test/filters/test_uglify_js.rb
nanoc-3.4.2 test/filters/test_uglify_js.rb
nanoc-3.4.1 test/filters/test_uglify_js.rb