Sha256: 138436c8b0ffbb59144c6ff8abc07b8b35b2c1193501a9def98e4cbd6bafb711

Contents?: true

Size: 744 Bytes

Versions: 1

Compression:

Stored size: 744 Bytes

Contents

# encoding: utf-8

class Nanoc::Filters::UglifyJSTest < Nanoc::TestCase

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

      # Run filter
      result = filter.setup_and_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.setup_and_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

1 entries across 1 versions & 1 rubygems

Version Path
nanoc-3.6.2 test/filters/test_uglify_js.rb