Skip to content

Commit

Permalink
Merge pull request #323 from rragan/master
Browse files Browse the repository at this point in the history
Fix Issue #322. block name in template includes previous text by mistake
  • Loading branch information
rragan committed Aug 29, 2013
2 parents b040e27 + c2e9fd1 commit e01891a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/dust.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ Context.prototype.current = function() {

Context.prototype.getBlock = function(key, chk, ctx) {
if (typeof key === "function") {
key = key(chk, ctx).data.join("");
chk.data = []; //ie7 perf
var tempChk = new Chunk();
key = key(tempChk, this).data.join("");
}

var blocks = this.blocks;
Expand Down
17 changes: 17 additions & 0 deletions test/jasmine-test/spec/coreTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,23 @@ var coreTests = [
expected: "Start\nChild Title\nChild Content\nEnd",
message: "should test child template"
},
{
name: "issue322",
source: 'hi{+"{name}"/}',
context: {},
expected: "hi",
message: "should setup base template for next test. hi should not be part of base block name"

},
{
name: "issue322 use base template picks up prefix chunk data",
source: '{>issue322 name="abc"/}' +
"{<abc}ABC{/abc}",
context: {},
expected: "hiABC",
message: "should use base template and honor name passed in"

},
{
name: "recursion",
source: "{name}{~n}{#kids}{>recursion:./}{/kids}",
Expand Down

0 comments on commit e01891a

Please sign in to comment.