핸들 막대 구성 요소를 렌더링하기위한 단위 테스트를 작성하려고합니다. 테스트가 실행되면 객체는 비어 있으며 HTML이 생성되지 않습니다. 나는 다른 구성 요소를 사용하여이 동일한 레이아웃을 따라 왔으며 제대로 렌더링됩니다. 나는 미정/반환 된 객체가 null 왜 혼란 스러워요 여기Ember 단위 테스트 렌더링 핸들이 null 또는 정의되지 않음을 반환합니다.
내 타다 남은 테스트 코드 : 시험의 출력이
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';
moduleForComponent('csv-upload', 'Integration | Component | csv upload', {
integration: true
});
test('it renders', function(assert) {
assert.expect(2);
this.render(hbs`{{csv-upload}}`);
assert.equal(this.$().text().trim(), '');
// Template block usage:
this.render(hbs`
{{#csv-upload}}
template block text
{{/csv-upload}}
`);
assert.equal(this.$().text().trim(), '');
});
입니다
: 출력에서 ok 32 PhantomJS 2.1 - JSHint - integration/pods/components/csv-upload/component-test.js: should pass jshint
not ok 33 PhantomJS 2.1 - Integration | Component | device actions: it renders
---
actual: >
null
또 다른 한가지 :
undefined is not an object (evaluating 'this.get('selected').isAny')
감사합니다! 대답에 투표하겠습니다. – ajputnam