Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ember component with optional block
<!-- app/templates/*.hbs -->
{{#if template}}
{{yield}}
{{else}}
{{defaultContent}}
{{/if}}
//tests/unit/components/*.js
test('component with optional block', function(assert) {
assert.expect(1);
var component = this.subject();
Ember.run(function(){
component.set('template', function(){ return 'Something else'; });
component.set('defaultContent', 'foo');
});
assert.trimEq(this.$().text(), 'Something else');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.