Sha256: 8a153cb5cf60f16aed1f723c5d7e1b2a2e4cdfa8ede39740b5b6502a850d33e2

Contents?: true

Size: 783 Bytes

Versions: 1

Compression:

Stored size: 783 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.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.1 test/filters/test_uglify_js.rb