簡體   English   中英

Ember.js與Ember.testing = true

[英]Ember.js with Ember.testing = true

我試圖在Ember.js中進行測試,並將Ember.testing = true標志設置為禁用自動運行循環等

我有這個代碼

Ember.testing = true;

Ember.run(function() {  
  App = Ember.Application.create();
});

App.Router.map(function() {
  this.route("home", { path: "/" });
});


Ember.run(function() {
  App.initialize();
});

我已經得到了thuis錯誤

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中運行異步代碼,根據我能找到的任何例子,我都有!

任何人都可以告訴我我做錯了什么甚至得到jsin示例不顯示此錯誤?

請參閱jsbin http://jsbin.com/uxalap/14/edit

更新:

我正在使用Konacha來運行我的測試,當我使用最新的RC1時,在Em.run中包裝Ember.Application.create()和App.initialize()時出現錯誤。 當我刪除這些我沒有錯誤。 這是最新的主人嗎?

謝謝里克

自RC1以來, Ember.testing已經更改,如果你想使用它,你應該使用master

這是一個更新的工作JSBin

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM