Reputation: 926
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.
Upvotes: 16
Views: 4522
Reputation: 11
Here is an article on using Jasmine to test Ember.js http://www.devmynd.com/blog/2014-1-ember-js-testing-with-jasmine
Upvotes: 1
Reputation: 16163
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/
Upvotes: 16
Reputation: 8732
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();
});
Upvotes: 2