Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issue #322. block name in template includes previous text by mistake #323

Merged
merged 2 commits into from
Aug 29, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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