Sha256: 04682e58ff5b0b32faccedd43c4aa7d509f40fc7ef8aca2567208d370e4daf87

Contents?: true

Size: 896 Bytes

Versions: 22

Compression:

Stored size: 896 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 /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 => boom
  warn "Tilt::TypeScriptTemplate (disabled)"
end

Version data entries

22 entries across 22 versions & 6 rubygems

Version Path
logstash-input-salesforce-3.0.0 vendor/jruby/1.9/gems/tilt-2.0.5/test/tilt_typescript_test.rb
ivanvc-logstash-input-s3-3.1.1.4 vendor/local/gems/tilt-2.0.5/test/tilt_typescript_test.rb
ivanvc-logstash-input-s3-3.1.1.3 vendor/local/gems/tilt-2.0.5/test/tilt_typescript_test.rb
ivanvc-logstash-input-s3-3.1.1.2 vendor/local/gems/tilt-2.0.5/test/tilt_typescript_test.rb
brakeman-3.4.1 bundle/ruby/2.3.0/gems/tilt-2.0.5/test/tilt_typescript_test.rb
brakeman-3.4.0 bundle/ruby/2.3.0/gems/tilt-2.0.5/test/tilt_typescript_test.rb
logstash-filter-delta-1.1.0 vendor/bundle/jruby/2.2.0/gems/tilt-2.0.5/test/tilt_typescript_test.rb
logstash-filter-delta-1.0.1 vendor/bundle/jruby/2.2.0/gems/tilt-2.0.5/test/tilt_typescript_test.rb
logstash-filter-base64-1.0.4 vendor/bundle/jruby/2.2.0/gems/tilt-2.0.5/test/tilt_typescript_test.rb
logstash-filter-base64-1.0.3 vendor/bundle/jruby/2.2.0/gems/tilt-2.0.5/test/tilt_typescript_test.rb
logstash-filter-delta-1.0.0 vendor/bundle/jruby/2.2.0/gems/tilt-2.0.5/test/tilt_typescript_test.rb
logstash-filter-base64-1.0.2 vendor/bundle/jruby/2.3.0/gems/tilt-2.0.5/test/tilt_typescript_test.rb
logstash-filter-base64-1.0.1 vendor/bundle/jruby/2.3.0/gems/tilt-2.0.5/test/tilt_typescript_test.rb
logstash-filter-base64-1.0.0 vendor/bundle/jruby/2.3.0/gems/tilt-2.0.5/test/tilt_typescript_test.rb
brakeman-3.3.5 bundle/ruby/2.3.0/gems/tilt-2.0.5/test/tilt_typescript_test.rb
brakeman-3.3.4 bundle/ruby/2.3.0/gems/tilt-2.0.5/test/tilt_typescript_test.rb
brakeman-3.3.3 bundle/ruby/2.3.0/gems/tilt-2.0.5/test/tilt_typescript_test.rb
brakeman-3.3.2 bundle/ruby/2.3.0/gems/tilt-2.0.5/test/tilt_typescript_test.rb
brakeman-3.3.1 bundle/ruby/2.3.0/gems/tilt-2.0.5/test/tilt_typescript_test.rb
tilt-2.0.5 test/tilt_typescript_test.rb