简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM