Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allows yielded template blocks to be optional

  • Loading branch information...
commit 0c15127a44e6d75b678defc1a4bbd9fafb994bb6 1 parent 14934d7
Christopher Sansone christophersansone authored
3  packages/ember-handlebars/lib/helpers/yield.js
View
@@ -11,6 +11,5 @@ Ember.Handlebars.registerHelper('yield', function(options) {
template = get(view, 'template');
- ember_assert("You called yield on " + view.toString() + " without supplying a template", !!template);
- template(this, options);
+ if (template) { template(this, options); }
});
16 packages/ember-handlebars/tests/helpers/yield_test.js
View
@@ -102,3 +102,19 @@ test("templates should yield to block, when the yield is embedded in a hierarchy
equal(view.$('div#container div.nesting div#block').length, 1, 'nesting view yields correctly even within a view hierarchy in the nesting view');
});
+test("block should not be required", function() {
+ TemplateTests.YieldingView = Ember.View.extend({
+ layout: Ember.Handlebars.compile('{{#view Ember.View tagName="div" classNames="yielding"}}{{yield}}{{/view}}')
+ });
+
+ view = Ember.View.create({
+ template: Ember.Handlebars.compile('<div id="container">{{view TemplateTests.YieldingView}}</div>')
+ });
+
+ Ember.run(function() {
+ view.appendTo('#qunit-fixture');
+ });
+
+ equal(view.$('div#container div.yielding').length, 1, 'yielding view is rendered as expected');
+});
+
Please sign in to comment.
Something went wrong with that request. Please try again.