Ember.js与Ember.testing = true

时间:2013-03-11 12:01:30

标签: javascript ember.js ember-data

我正在尝试在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 here http://jsbin.com/uxalap/14/edit

更新:

我正在使用Konacha来运行我的测试,当我使用最新的RC1时,在Em.run中包装Ember.Application.create()和App.initialize()时出错。当我删除这些我没有错误。这是现在最新的主人吗?

由于 瑞克

1 个答案:

答案 0 :(得分:1)

自RC1以来

Ember.testing已更改,如果您想使用它,则应使用master

Here's an updated working JSBin