Skip to content

Commit

Permalink
Merge pull request #557 from sethkinast/fix-format
Browse files Browse the repository at this point in the history
Fix the output of format (whitespace-only) blocks inside inline partials
  • Loading branch information
prashn64 committed Mar 11, 2015
2 parents 6fffa4b + 4cbe3a4 commit 0af1d54
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
},

format: function(context, node) {
return '.w(' + escape(node[1] + node[2]) + ')';
return '.w(' + escape(node[1]) + ')';
},

reference: function(context, node) {
Expand Down
34 changes: 33 additions & 1 deletion test/jasmine-test/spec/coreTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,39 @@ var coreTests = [
{
name: "whitespace test",
tests: [
{
{
name: "whitespace on: whitespace-only template",
source: "\n ",
context: {},
expected: "\n ",
message: "whitespace on: whitespace-only template is preserved",
config: { whitespace: true }
},
{
name: "whitespace off: whitespace-only template",
source: "\n ",
context: {},
expected: "",
message: "whitespace off: whitespace-only template is removed",
config: { whitespace: false }
},
{
name: "whitespace on: whitespace-only block",
source: "{<foo}\n{/foo}{+foo/}",
context: {},
expected: "\n",
message: "whitespace on: whitespace-only block is preserved",
config: { whitespace: true }
},
{
name: "whitespace off: whitespace-only block",
source: "{<foo}\n{/foo}{+foo/}",
context: {},
expected: "",
message: "whitespace off: whitespace-only block is removed",
config: { whitespace: false }
},
{
name: "whitespace off: multiline text block runs together",
source: ["<p>",
" foo bar baz",
Expand Down

0 comments on commit 0af1d54

Please sign in to comment.