mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Fix falsy helpers (like 0)
This commit is contained in:
@@ -64,7 +64,7 @@ Blaze.View.prototype.lookup = function (name, _options) {
|
||||
} else if (lookupTemplate && (name in Blaze.Template) &&
|
||||
(Blaze.Template[name] instanceof Blaze.Template)) {
|
||||
return Blaze.Template[name];
|
||||
} else if (Blaze._globalHelpers[name]) {
|
||||
} else if (Blaze._globalHelpers[name] != null) {
|
||||
return wrapHelper(bindDataContext(Blaze._globalHelpers[name]));
|
||||
} else {
|
||||
return function () {
|
||||
|
||||
@@ -992,3 +992,7 @@ Hi there!
|
||||
{{/with}}
|
||||
{{/with}}
|
||||
</template>
|
||||
|
||||
<template name="spacebars_template_test_falsy_helper">
|
||||
foo:{{foo}} GLOBAL_ZERO:{{GLOBAL_ZERO}}
|
||||
</template>
|
||||
|
||||
@@ -2903,3 +2903,12 @@ Tinytest.add("spacebars-tests - template_tests - content context back-compat", f
|
||||
Tracker.flush();
|
||||
test.equal(canonicalizeHtml(div.innerHTML), 'FA');
|
||||
});
|
||||
|
||||
Tinytest.add("spacebars-tests - template_tests - falsy helper", function (test) {
|
||||
var tmpl = Template.spacebars_template_test_falsy_helper;
|
||||
tmpl.foo = 0;
|
||||
Template.registerHelper('GLOBAL_ZERO', 0);
|
||||
|
||||
var div = renderToDiv(tmpl);
|
||||
test.equal(canonicalizeHtml(div.innerHTML), 'foo:0 GLOBAL_ZERO:0');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user