Sha256: f12945adc72cfb6da4c9b66d5e276911c63b03ca60f8254c8e123f593813c8dd
Contents?: true
Size: 1.24 KB
Versions: 3
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(context) { return HandlebarsTemplates["x11"](context); }; 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;}); END_EXPECTED end end end
Version data entries
3 entries across 3 versions & 1 rubygems