Skip to content

Commit

Permalink
Merge pull request canjs#485 from bitovi/renderer-consistency-485
Browse files Browse the repository at this point in the history
Issue: can.view.ejs(str) and can.view.ejs(id, str) return different responses
  • Loading branch information
daffl committed Oct 14, 2013
2 parents d41f222 + a082ced commit 55c06f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 1 addition & 2 deletions view/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,8 +669,7 @@ steal("can/util", function( can ) {
return renderer;
}

$view.preload(id, info.renderer(id, text));
return can.view(id);
return $view.preload(id, info.renderer(id, text));
}
},
registerScript: function( type, id, src ) {
Expand Down
12 changes: 12 additions & 0 deletions view/view_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,4 +704,16 @@
equal(div.getElementsByTagName("h3")[0].innerHTML, 'Hi test',
'Got expected test from extensionless template');
});

test("can.view[engine] always returns fragment renderers (#485)", 2, function() {
var template = "<h1>{{message}}</h1>";
var withId = can.view.mustache('test-485', template);
var withoutId = can.view.mustache(template);

ok(withoutId({ message: 'Without id'}) instanceof DocumentFragment,
'View without id returned document fragment');

ok(withId({ message: 'With id'}) instanceof DocumentFragment,
'View with id returned document fragment');
});
})();

0 comments on commit 55c06f2

Please sign in to comment.