Sha256: 83a2b7592ddd48b888bd174fb83d400dc2cc2300c1a07a17f94f21db13a3f227

Contents?: true

Size: 857 Bytes

Versions: 2

Compression:

Stored size: 857 Bytes

Contents

require 'test_helper'

class Es6TiltTest < ActiveSupport::TestCase
  test "truth" do
    assert_kind_of Module, Es6Tilt
  end

  test "transpile" do
    template = ES6Tilt::ES6Transformer.new('./test/dummy/app/assets/javascripts/test.es6')
    output = template.render
    expectation = "var Test = (function () { 'use strict';

var babelHelpers = {};

babelHelpers.classCallCheck = function (instance, Constructor) {
  if (!(instance instanceof Constructor)) {
    throw new TypeError(\"Cannot call a class as a function\");
  }
};

babelHelpers;
foo = {
	bar: \"Bar\"
};

var Person = function Person() {
    var args = arguments.length <= 0 || arguments[0] === undefined ? \"default\" : arguments[0];
    babelHelpers.classCallCheck(this, Person);

    this.eat = \"happy Meal\";
};

return Person;

})();"
    assert_equal output, expectation
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
es6_tilt-0.1.2 test/es6_tilt_test.rb
es6_tilt-0.1.1 test/es6_tilt_test.rb