mjallday
mjallday

Reputation: 10072

How do I test Ember.js routes

I want to write a test for my ember.js application that looks something like this but I'm having not having any luck after Googling:

... setup fixtures here ...

App.navigate_to_path('/some_resource')
equal($('#some-element').text(), 'expected value', 'message')

Is this possible or am I approaching this from the wrong direction?

Upvotes: 4

Views: 958

Answers (1)

Teddy Zeenny
Teddy Zeenny

Reputation: 3971

You can create a function like this:

function navigateTo(url) {
  App.__container_.lookup('router:main').handleURL(url);
}

You can check out how the ember core team are testing routes here

Upvotes: 6

Related Questions