Skip to content

Commit

Permalink
Tentative fix for the apparent currentURL bug
Browse files Browse the repository at this point in the history
It turns out that this isn't so much a problem with currentURL as it is
the visit helper. When the lazy router location work was completed in
8e130e5 the call to `router.location.setURL()` was moved down in the
else case after checking for readiness deferrals. The problem seems to be
a timing issue with the call to setupRouter after the application is
marked ready. The initialURL, while set, doesn't give us a reliable URL
during tests.

The fix suggested here is based on my limited understanding of the
lifecycle of the router during boot time. This passes the newly added
url helper tests as well as the existing tests in the test suite.

If it isn't 'the fix' perhaps it can point a way to the real deal.
  • Loading branch information
elskwid committed May 18, 2015
1 parent 7cb97a9 commit 18bcf9f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/ember-testing/lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ function focus(el) {

function visit(app, url) {
var router = app.__container__.lookup('router:main');
router._setupLocation();
router.location.setURL(url);

if (app._readinessDeferrals > 0) {
router['initialURL'] = url;
Expand Down

0 comments on commit 18bcf9f

Please sign in to comment.