ember.js - Unable to find partial in a component test -



ember.js - Unable to find partial in a component test -

i have component test failing because can't find partial template rendering. specific error "assertion failed: unable find partial name 'components/activity-list-item-content'."

my test file default generated ember-cli:

import { moduleforcomponent, test } 'ember-qunit'; moduleforcomponent('activity-list-item', 'activitylistcomponent', { // specify other units required test needs: ['helper:format-date'] }); test('it renders', function() { expect(2); // creates component instance var component = this.subject(); equal(component._state, 'prerender'); // appends component page this.append(); equal(component._state, 'indom'); });

and component template looks 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 working fine without errors, i'm wondering if it's missing test setup. i've tried adding needs array , same error:

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

how tests find partial?

update

@gjk pointed out partial name should start underscore instead of dash. if create change, test passes, depcrecation warning in console says:

deprecation: modules should not contain underscores. attempted lookup "myapp-ember/templates/components/-activity-list-item-content" not found. please rename "myapp-ember/templates/components/_activity-list-item-content" "myapp-ember/templates/components/-activity-list-item-content" instead.

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

the current workaround is:

import resolver '../../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')); } });

ember.js ember-cli ember-qunit

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -