mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge branch 'devel-#801-fixed' of git://github.com/raix/meteor into raix-815
This commit is contained in:
@@ -35,7 +35,7 @@ Handlebars._default_helpers = {
|
||||
if (data && data.length > 0)
|
||||
return _.map(data, function(x, i) {
|
||||
// infer a branch key from the data
|
||||
var branch = (x._id || (typeof x === 'string' ? x : null) ||
|
||||
var branch = ((x && x._id) || (typeof x === 'string' ? x : null) ||
|
||||
Spark.UNIQUE_LABEL);
|
||||
return Spark.labelBranch(branch, function() {
|
||||
return options.fn(x);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
arg,
|
||||
function (item) {
|
||||
return Spark.labelBranch(
|
||||
item._id || Spark.UNIQUE_LABEL, function () {
|
||||
(item && item._id) || Spark.UNIQUE_LABEL, function () {
|
||||
var html = Spark.isolate(_.bind(options.fn, null, item));
|
||||
return Spark.setDataContext(item, html);
|
||||
});
|
||||
|
||||
@@ -350,3 +350,8 @@
|
||||
<template name="test_template_trickylabels_a2">
|
||||
<div>foo</div>
|
||||
</template>
|
||||
|
||||
<!-- Test for issue #801 - Each handling of falsy values eg. [1, 2, null, undefined] -->
|
||||
<template name="test_template_issue801">
|
||||
{{#each values}}{{this}}{{/each}}
|
||||
</template>
|
||||
|
||||
@@ -1085,3 +1085,10 @@ Tinytest.add("templating - tricky branch labels", function (test) {
|
||||
div.kill();
|
||||
Deps.flush();
|
||||
});
|
||||
|
||||
Tinytest.add('templating - each falsy Issue #801', function (test) {
|
||||
//Minor test for issue #801
|
||||
Template.test_template_issue801.values = function() { return [1,2,null,undefined]; };
|
||||
var frag = Meteor.render(Template.test_template_issue801);
|
||||
test.equal(canonicalizeHtml(DomUtils.fragmentToHtml(frag)), "12null");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user