我正在尝试在 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() 时出现错误。当我删除这些时,我没有收到任何错误。这在最新的 master 中是否正确?
谢谢 瑞克
最佳答案
Ember.testing
自 RC1 以来已更改,如果你想使用它,你应该使用 master
关于javascript - 带有 Ember.testing = true 的 Ember.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15338081/