Skip to content

Commit

Permalink
Refix issue #770
Browse files Browse the repository at this point in the history
{{#with falseyValue}} should render {{else}} content
  • Loading branch information
avital committed Nov 8, 2013
1 parent 3b909dc commit 87bdd34
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
23 changes: 23 additions & 0 deletions template_tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,26 @@
{{/each}}
</select>
</template>

<!-- Test for issue #770 - falsy value for with. (newlines break this test on IE8) -->
<template name="test_template_issue770">
{{# with value1}}
{{this}}
{{else}}
xxx
{{/with}}

{{# with value2}}
{{this}}
{{else}}
xxx
{{/with}}

{{# with value1}}
{{this}}
{{/with}}

{{# with value2}}
{{this}}
{{/with}}
</template>
7 changes: 7 additions & 0 deletions template_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,3 +551,10 @@ Tinytest.add("spacebars - templates - select tags", function (test) {

});

Tinytest.add('spacebars - templates - {{#with}} falsy; issue #770', function (test) {
Template.test_template_issue770.value1 = function () { return "abc"; };
Template.test_template_issue770.value2 = function () { return false; };
var div = renderToDiv(Template.test_template_issue770);
test.equal(canonicalizeHtml(trimAndRemoveSpaces(div.innerHTML)),
"abcxxxabc");
});

0 comments on commit 87bdd34

Please sign in to comment.