Testing Contextual Components?


How do you test contextual components?

Let’s say I have the code in the EmberJS - Sharing Component Data with its Wrapped Content guide, and I’m looking to test blog-post. In the example, blog-post yields another component – either markdown-style or html-style. So do I need to have one of those components already written to test blog-post, or do I mock a yielded component… and if so, how?


Unit? Use needs which is mentioned here to pull your yielded components into your test… To stub, use this.register which is documented here.

Integration? No need to stub.

Unsure why this information is scattered across projects and not really focused on in the docs. I could see how anyone unfamiliar might be unable to track these down.