-
-
Notifications
You must be signed in to change notification settings - Fork 873
Conversation
Often you might define a component which works in block form: | ||
|
||
```app/templates/components/my-component.hbs | ||
{{#if template}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We intend to add hasBlock?
helper for this, I am unsure that we should suggest this (though checking template
will likely always work).
Going to close from lack of reply/activity. Feel free to re-open if we can address @rwjblue's question. |
What was the question? lol. Looks like we are waiting on |
Accessing |
Also, setting |
@rwjblue so just replace template with hasBlock? |
What's the alternative to setting |
Yes, without the question mark: {{#if hasBlock}}
Stuff
{{/if}} |
@rwjblue what about setting the template? What's the new API for that? |
There isn't one. The template for a component is supplied by the block provided by the calling location. Please explain the intent of changing the template of a component, maybe I have a better answer/explaination... |
For testing integration between different components, e.g. {{#video-player as |playing|}}
{{ad-overlay ad=myAd playing=playing}}
{{/video-player}} Or even static data, since you want to test if your component is behaving correctly when in block mode. |
For testing, you should be using the newer style component integration tests. We need more documentation for it though. Added in emberjs/ember-test-helpers#38, you can do something like this example from liquid-fire. |
Basically taken from https://gist.github.com/code0100fun/f5922b6f44eee2abc21d
Thanks @code0100fun and https://emberweekend.firebaseapp.com/episodes/the-weekend-strikes-back