Sha256: a9ebb634d203bc44a629b4a357cee6615be9fae62343d10bd50f6a6547ccd0ce

Contents?: true

Size: 1.24 KB

Versions: 5

Compression:

Stored size: 1.24 KB

Contents

require 'test_helper'

module HandlebarsAssets
  class TiltHandlebarsTest < Test::Unit::TestCase
    def test_render
      # Try to act like sprockets.
      scope = Object.new
      class << scope
        def logical_path ; 'x11' ; end
      end
      template = HandlebarsAssets::TiltHandlebars.new('/myapp/app/assets/templates/x11.jst.hbs') { "This is {{handlebars}}" }
      assert_equal <<END_EXPECTED, template.render(scope, {})
          (function() {
            this.HandlebarsTemplates || (this.HandlebarsTemplates = {});
            this.HandlebarsTemplates["x11"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
  helpers = helpers || Handlebars.helpers;
  var buffer = "", stack1, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;


  buffer += "This is ";
  stack1 = helpers.handlebars || depth0.handlebars;
  if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
  else if(stack1=== undef) { stack1 = helperMissing.call(depth0, "handlebars", { hash: {} }); }
  buffer += escapeExpression(stack1);
  return buffer;});
            return HandlebarsTemplates["x11"];
          }).call(this);
END_EXPECTED
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
handlebars_assets-0.4.4 test/handlebars_assets/tilt_handlebars_test.rb
handlebars_assets-0.4.3 test/handlebars_assets/tilt_handlebars_test.rb
handlebars_assets-0.4.1 test/handlebars_assets/tilt_handlebars_test.rb
handlebars_assets-0.4.0 test/handlebars_assets/tilt_handlebars_test.rb
handlebars_assets-0.3.1 test/handlebars_assets/tilt_handlebars_test.rb