Search code examples
javascriptember.jsember-qunit

Testing an ember component that uses another component with separate template


I'm trying to test an emberjs component that uses another component. I'm using ember-qunit with the moduleForComponent method. In there I define that my component needs another component, needs: ['component:my-kitten'].

But it seems that if you use a component with a separate template, then the template of that component is not loaded.

I altered the jsbin example from the emberjs guides.

Working example with template defined in the component as layout

Not working example where I moved the layout to a separate template


Solution

  • The needs property must also include any nested component templates:

    ...
    needs: ['component:my-kitten', 'template:components/my-kitten'],
    ...
    

    Look for "If you are using nested components with templates" on https://github.com/rwjblue/ember-qunit.