Could not find partial in component test

I have a component test that fails because it cannot find partial that the template is rendering. The specific error is "Error statement: it is not possible to find a partial with the name" component / list-element-element-content-element ".

My test file is mainly created by ember-cli by default:

import {
  moduleForComponent,
  test
} from 'ember-qunit';

moduleForComponent('activity-list-item', 'ActivityListComponent', {
  // specify the other units that are required for this test
  needs: ['helper:format-date']
});

test('it renders', function() {
  expect(2);

  // creates the component instance
  var component = this.subject();
  equal(component._state, 'preRender');

  // appends the component to the page
  this.append();
  equal(component._state, 'inDOM');
});

and a component template that looks like this:

{{#if activity.momentId}}
  {{#link-to 'moment' momentId class='close-dropdown'}}
    {{partial 'components/activity-list-item-content'}}
  {{/link-to}}
{{else}}
  {{partial 'components/activity-list-item-content'}}
{{/if}}

My application works fine without any errors, so I wonder if something is missing in my test setup. I also tried adding it to the array needsand getting the same error:

needs: ['helper:format-date', 'template:components/-activity-list-item-content']

How do I get my tests to find partial?

Update

@GJK , . , , , :

DEPRECATION: . "myapp-ember/templates/components/-activity-list-item-content", . "myapp-ember/templates/components/_activity-list-item-content" "myapp-ember/templates/components/-activity-list-item-content".

+4
1

: https://github.com/rwjblue/ember-qunit/issues/110

:

import resolver from '../../helpers/resolver';

moduleForComponent('some-other-thing', 'component:some-other-thing', {
  needs: ['component:some-thing'],

  setup: function() {
    this.container.register('template:path/to/partial', 
           resolver.resolve('template:path/to/-partial'));
  }
});
0

All Articles