Jasmine을 사용하여 EmberJS 프로젝트를 테스트하는 유닛에서 작업하고 있지만 Ember 's needs API에 문제가 있습니다.EmberJS 테스트에 실패한 재스민 테스트
나는 자스민 테스트를 실행하려고하면, 그들은 (문제의 컨트롤러가 "필요"뿐만 아니라
this._super를 호출하는 init 함수가있는 경우, 컨트롤러 인스턴스를 생성 실패)
나는
"를 널 (null)의 '이'메서드를 호출 할 수 없습니다"이 콘솔 오류를 얻을이
디버깅을 시도 할 때 Ember의 창자로 나를 데려왔지만 아무 것도 없었습니다. 내가
var searchPendingController = Application.SearchPendingController.create();
누구든지 이것에 대해 어떤 아이디어가이 컨트롤러를 만들려고 할 때
사람은 내가
Application.SearchPendingController = Ember.ObjectController.extend({
needs: ['searchResults', 'search'],
shouldDisable: false,
searchResultsController: null,
init: function() {
this._super();
this.set('searchResultsController', this.controllerFor('searchResults'));
this.get('controllers.search.content').reload();
this.get('controllers.searchResults').set('content', this.get('controllers.search.content.results'));
},
transitionToResults: function() {
console.log('yay');
}.observes('this.searchResultsController.content')
});
재스민 테스트
이 오류가 발생 잘못 뭘하는지 어떤 생각을 가지고?
이 완벽했다. 무리 감사. – johnjo
아, 맞아 .. 고정 : –
고마워. 어리석은 수표 같아요. 이것이 기본 동작이 아니겠습니까? 'didInsertElement'가'this.get ('controller'). domLoaded()'를 호출하여 해당 컨트롤러를 인스턴스화하는 뷰를 가지고 있습니다 ... 나는 또한 할 수있을 것이라고 생각했습니다. 'this.set ('childController', App.ChildController.createWithMixins ({container :이})')하지만 작동하지 않았지만 다시'App .__ container__'를 사용하여 ... – ilovett