testing ember.js apps with jasmine

早过忘川 提交于 2019-12-03 07:11:44

问题


Does anyone know of any resources, examples or tutorials about testing ember.js apps ?

How do you test views ?

There does not seem to be any extensive examples / information on this.


回答1:


I can't propose an example how you can achieve that, but I have found a project which extensively uses Jasmine for their test: you should take a look at the ember-resource project on GitHub. It uses Jasmine for their tests, which are located in spec/javascripts.

The project also has a Rakefile and corresponding tasks which let you execute the specs in a convenient way.


There is a blog post about testing Ember.js with Jasmine: http://www.thesoftwaresimpleton.com/blog/2012/04/03/testing-ember-and-the-runloop/




回答2:


You could also use the testing functionality of Ember itself, as described in this post

What is basically does is disabling the Ember runloop by setting: Ember.testing = true This way you don't have to check if your asynchronous code is finished. You simple could wrap it in its own runloop:

// Creating an application normally happens async,
// which is why we have to wrap it in Ember.run
Ember.run(function() {
  App = Ember.Application.create();
});



回答3:


Here is an article on using Jasmine to test Ember.js http://www.devmynd.com/blog/2014-1-ember-js-testing-with-jasmine



来源:https://stackoverflow.com/questions/11253339/testing-ember-js-apps-with-jasmine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!