File: tilt_babeltemplate_test.rb

package info (click to toggle)
ruby-tilt 2.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 648 kB
  • sloc: ruby: 4,998; makefile: 7
file content (29 lines) | stat: -rw-r--r-- 751 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require_relative 'test_helper'

checked_describe 'tilt/babel' do
  it "registered for '.es6' files" do
    assert_equal Tilt::BabelTemplate, Tilt['es6']
  end

  it "registered for '.babel' files" do
    assert_equal Tilt::BabelTemplate, Tilt['babel']
  end

  it "registered for '.jsx' files" do
    assert_equal Tilt::BabelTemplate, Tilt['jsx']
  end

  it "basic ES6 features" do
    with_utf8_default_encoding do
      template = Tilt::BabelTemplate.new { "square = (x) => x * x" }
      assert_match "function", template.render
    end
  end

  it "JSX support" do
    with_utf8_default_encoding do
      template = Tilt::BabelTemplate.new { "<Awesome ness={true} />" }
      assert_match "React.createElement", template.render
    end
  end
end