Sha256: 279a1f315e83da165e6717b7ba0738cbdc5a9723d8bb4c6fd62e483eb287793f

Contents?: true

Size: 741 Bytes

Versions: 9

Compression:

Stored size: 741 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_equal("foo=1,function(a){alert(a)}(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_equal("foo=1,function(a){alert(a)}(foo);", result)
    end
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
nanoc-3.4.0 test/filters/test_uglify_js.rb
nanoc-3.3.7 test/filters/test_uglify_js.rb
nanoc-3.3.6 test/filters/test_uglify_js.rb
nanoc-3.3.5 test/filters/test_uglify_js.rb
nanoc-3.3.4 test/filters/test_uglify_js.rb
nanoc-3.3.3 test/filters/test_uglify_js.rb
nanoc-3.3.2 test/filters/test_uglify_js.rb
nanoc-3.3.1 test/filters/test_uglify_js.rb
nanoc-3.3.0 test/filters/test_uglify_js.rb