2016-06-07 2 views
1

나는 엠버 구성 요소로 jQuery File Upload을 사용하고 있습니다. 이 플러그인에는 테스트에서 파일 업로드 programmatically과 상호 작용할 수있는 API가 있습니다. 이것은 구성 요소 테스트에서 완벽하게 작동합니다.수락 테스트 파일 업로드

Assertion Failed: You have turned on testing mode, which disabled the run-loop's autorun. You will need to wrap any code with asynchronous side-effects in a run

내 테스트에서 미리보기가 :

// some steps before this. 

andThen(() => { 
    Ember.run(() => { 
    find('.file-upload').fileupload('send', { files: [{name: 'file.doc' }] }); 
    }); 
    }); 
}); 

모든 포인터가 많이 주시면 감사하겠습니다 그러나 입학 시험에서 나는이 오류가 발생합니다.

답변

0

나는이 잠시 뒤를 만났다. 이를 처리하려면 Ember.run 루프에서 비동기 인 실제 구성 요소 코드 (테스트 코드 아님)를 래핑해야합니다. 이렇게하면 프로그램에 영향을 미치지 않으므로 응용 프로그램의 주 실행 루프와 병합됩니다.

이렇게하면 테스트하는 동안 코드가 비동기 적으로 실행됩니다.

여기에 대한 자세한 내용은 여기를 참조하십시오. http://discuss.emberjs.com/t/guide-asynchronous-side-effects-in-testing/2905

관련 문제