can-stache
Advanced tools
Comparing version 4.16.0 to 4.17.0
@@ -71,2 +71,19 @@ var QUnit = require("steal-qunit"); | ||
QUnit.test("let blocks allow reassigning variables #645", function(){ | ||
var template = stache( | ||
"{{#let foo='bar'}}" + | ||
"<p>{{foo}}</p>" + | ||
"{{/let}}" + | ||
"{{#let foo='baz'}}" + | ||
"<p>{{foo}}</p>" + | ||
"{{/let}}" + | ||
"<p>foo-{{foo}}</p>" | ||
); | ||
var frag = template(new Scope({})); | ||
var paragraphs = frag.querySelectorAll('p'); | ||
QUnit.equal( paragraphs[0].innerHTML, "bar", "first value still works"); | ||
QUnit.equal( paragraphs[1].innerHTML, "baz", "reassigning foo works"); | ||
QUnit.equal( paragraphs[2].innerHTML, "foo-", "foo is not available outside of let block"); | ||
}); | ||
QUnit.test("let works after calling helpersCore.__resetHelpers", function() { | ||
@@ -73,0 +90,0 @@ helpersCore.__resetHelpers(); |
@@ -8,2 +8,5 @@ var canReflect = require("can-reflect"); | ||
var letHelper = function(options){ | ||
if(options.isSection){ | ||
return options.fn( options.scope.addLetContext( options.hash ) ); | ||
} | ||
var variableScope = options.scope.getScope(isVariable); | ||
@@ -10,0 +13,0 @@ if(!variableScope) { |
{ | ||
"name": "can-stache", | ||
"version": "4.16.0", | ||
"version": "4.17.0", | ||
"description": "Live binding handlebars templates", | ||
@@ -5,0 +5,0 @@ "homepage": "https://canjs.com/doc/can-stache.html", |
571632
11197