Skip to content

Commit

Permalink
Merge pull request emberjs#51 from joliss/tests
Browse files Browse the repository at this point in the history
Loosen up tests so they survive Ember upgrades
  • Loading branch information
tchak committed May 8, 2012
2 parents 60461c4 + 597b133 commit ab2b454
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/hjstemplate_test.rb
Expand Up @@ -57,13 +57,13 @@ def with_template_root(root, sep=nil)
test "asset pipeline should serve template" do
get "/assets/templates/test.js"
assert_response :success
assert @response.body == "Ember.TEMPLATES[\"test\"] = Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {\nhelpers = helpers || Ember.Handlebars.helpers;\n var buffer = '', stack1, stack2, stack3, stack4, tmp1, self=this, functionType=\"function\", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;\n\n\n stack1 = depth0;\n stack2 = \"test\";\n stack3 = {};\n stack4 = \"true\";\n stack3['escaped'] = stack4;\n stack4 = helpers._triageMustache || depth0._triageMustache;\n tmp1 = {};\n tmp1.hash = stack3;\n tmp1.contexts = [];\n tmp1.contexts.push(stack1);\n tmp1.data = data;\n if(typeof stack4 === functionType) { stack1 = stack4.call(depth0, stack2, tmp1); }\n else if(stack4=== undef) { stack1 = helperMissing.call(depth0, \"_triageMustache\", stack2, tmp1); }\n else { stack1 = stack4; }\n data.buffer.push(escapeExpression(stack1) + \"\\n\");\n return buffer;\n});\n", @response.body.inspect
assert_match @response.body, /Ember\.TEMPLATES\["test"\] = Ember\.Handlebars\.template\(function .*"test"/m
end

test "should unbind mustache templates" do
get "/assets/templates/hairy.mustache"
assert_response :success
assert @response.body == "Ember.TEMPLATES[\"hairy\"] = Ember.Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {\nhelpers = helpers || Ember.Handlebars.helpers;\n var buffer = '', stack1, stack2, stack3, tmp1, self=this, functionType=\"function\", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;\n\n\n data.buffer.push(\"This is a great <img src=\\\"\");\n stack1 = depth0;\n stack2 = \"image\";\n stack3 = helpers.unbound || depth0.unbound;\n tmp1 = {};\n tmp1.hash = {};\n tmp1.contexts = [];\n tmp1.contexts.push(stack1);\n tmp1.data = data;\n if(typeof stack3 === functionType) { stack1 = stack3.call(depth0, stack2, tmp1); }\n else if(stack3=== undef) { stack1 = helperMissing.call(depth0, \"unbound\", stack2, tmp1); }\n else { stack1 = stack3; }\n data.buffer.push(escapeExpression(stack1) + \"\\\" />\\n\");\n return buffer;\n});\n", @response.body.inspect
assert_match @response.body, /Ember\.TEMPLATES\["hairy"\] = Ember\.Handlebars\.template\(function .*unbound/m
end

test "ensure new lines inside the anon function are persisted" do
Expand Down

0 comments on commit ab2b454

Please sign in to comment.