下面的教程和其他線程我不能使測試在運行異步代碼時運行。以下是我一直試圖測試的內容:http://emberjs.jsbin.com/xacurasi/1/edit?html,js,output以及入門工具包中提供的測試。使用?test
參數打開時應用程序窗口(編輯:顯示實際應用程序的框架,而不是qunit測試頁面)顯示空白頁面。Emberjs - 如何測試承諾和其他異步行爲?
這裏是我唯一的異步代碼:
App.IndexRoute = Ember.Route.extend({
model: function() {
var promise;
Ember.run(function() {
promise = Em.$.getJSON('http://123.345.456.78/ajax/server.php');
});
return promise;
}
});
錯誤我收到的控制檯:
Uncaught Error: 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 an Ember.run
這是相當混亂,因爲我沒有在Ember.run(function() { //my code here});
https://gist.github.com/anonymous/8a30621ca2a8e2d890d1 –