Sha256: c2ace57e293740b4519cd94b0aac2cbc532dd045b1a802b051d315f592b89356

Contents?: true

Size: 890 Bytes

Versions: 22

Compression:

Stored size: 890 Bytes

Contents

require 'test_helper'
require 'tilt'

begin
  require 'tilt/typescript'

  class TypeScriptTemplateTest < Minitest::Test
    def setup
      @ts = "var x:number = 5"
      @js = /var x = 5;\s*/
    end

    test "is registered for '.ts' files" do
      assert_equal Tilt::TypeScriptTemplate, Tilt['test.ts']
    end

    test "compiles and evaluates the template on #render" do
      template = Tilt::TypeScriptTemplate.new { @ts }
      assert_match @js, template.render
    end

    test "supports source map" do
      template = Tilt::TypeScriptTemplate.new(inlineSourceMap: true)  { @ts }
      assert_match %r(sourceMappingURL), template.render
    end

    test "can be rendered more than once" do
      template = Tilt::TypeScriptTemplate.new { @ts }
      3.times { assert_match @js, template.render }
    end
  end
rescue LoadError
  warn "Tilt::TypeScriptTemplate (disabled)"
end

Version data entries

22 entries across 21 versions & 9 rubygems

Version Path
logstash-filter-csharp-0.2.1 vendor/bundle/jruby/2.3.0/gems/tilt-2.0.7/test/tilt_typescript_test.rb
logstash-filter-csharp-0.2.0 vendor/bundle/jruby/2.3.0/gems/tilt-2.0.7/test/tilt_typescript_test.rb
logstash-output-icinga-1.1.0 vendor/jruby/1.9/gems/tilt-2.0.7/test/tilt_typescript_test.rb
logstash-output-icinga-1.1.0 vendor/jruby/2.3.0/gems/tilt-2.0.7/test/tilt_typescript_test.rb
logstash-filter-cache-redis-0.3.1 vendor/bundle/jruby/1.9/gems/tilt-2.0.7/test/tilt_typescript_test.rb
logstash-filter-cache-redis-0.3.0 vendor/bundle/jruby/1.9/gems/tilt-2.0.7/test/tilt_typescript_test.rb
logstash-filter-cache-redis-0.2.0 vendor/bundle/jruby/1.9/gems/tilt-2.0.7/test/tilt_typescript_test.rb
logstash-filter-cache-redis-0.1.0 vendor/bundle/jruby/1.9/gems/tilt-2.0.7/test/tilt_typescript_test.rb
brakeman-3.7.0 bundle/ruby/2.3.0/gems/tilt-2.0.7/test/tilt_typescript_test.rb
logstash-filter-csharp-0.1.0 vendor/bundle/jruby/2.3.0/gems/tilt-2.0.7/test/tilt_typescript_test.rb
logstash-filter-htmlentities-0.1.0 vendor/bundle/jruby/1.9/gems/tilt-2.0.7/test/tilt_typescript_test.rb
brakeman-3.6.2 bundle/ruby/2.3.0/gems/tilt-2.0.7/test/tilt_typescript_test.rb
logstash-output-icinga-1.0.0 vendor/jruby/1.9/gems/tilt-2.0.7/test/tilt_typescript_test.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/tilt-2.0.7/test/tilt_typescript_test.rb
brakeman-3.6.1 bundle/ruby/2.3.0/gems/tilt-2.0.7/test/tilt_typescript_test.rb
brakeman-3.6.0 bundle/ruby/2.3.0/gems/tilt-2.0.7/test/tilt_typescript_test.rb
tilt-2.0.7 test/tilt_typescript_test.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/tilt-2.0.6/test/tilt_typescript_test.rb
logstash-input-fifo-0.9.1 vendor/bundle/jruby/1.9/gems/tilt-2.0.6/test/tilt_typescript_test.rb
logstash-input-fifo-0.9.0 vendor/bundle/jruby/1.9/gems/tilt-2.0.6/test/tilt_typescript_test.rb