Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

currentURL() result when at root has changed in Ember 1.12.0-beta.1 #10784

Closed
backspace opened this issue Mar 31, 2015 · 14 comments
Closed

currentURL() result when at root has changed in Ember 1.12.0-beta.1 #10784

backspace opened this issue Mar 31, 2015 · 14 comments
Milestone

Comments

@backspace
Copy link

In short:

visit('/');

andThen(function() {
  // Ember 1.11
  console.log(currentURL()); // => '/'

  // Ember 1.12.0-beta.1
  console.log(currentURL()); // => '';
});

We have been developing an Ember CLI application on the 1.11 betas, so today I updated to the first 1.12 beta to try it out. Everything continued to work except a few acceptance test assertions about the currentURL().

Previously, if the application was at /, currentURL() returned /. Now it returns an empty string. On other routes, it still returns a string with / at the beginning.

When I run ApplicationName.__container__.lookup('router:main').location.getURL() in development, which I believe is the same code used by currentURL(), I get /. So this in-test behaviour seems incorrect to me.

It seemed infeasible to make a JSBin to demonstrate this since it’s only happening in tests, but I did create a small demonstration Ember CLI application. I did verify that it’s still happening in the canary version.

It’s trivial to change our tests to look for an empty string instead of /, so if that’s the intended behaviour just let me know and I’ll update the tests so we can keep working with the betas.

@rwjblue
Copy link
Member

rwjblue commented Mar 31, 2015

The change seems odd to me. It is likely a result of the boot process changes, but it does not seem like an intentional change to me...

Demos:

@rwjblue rwjblue added this to the 1.12.0-beta.1 milestone Mar 31, 2015
@jgwhite
Copy link
Contributor

jgwhite commented Apr 2, 2015

Could this be related to #10801?

@rwjblue
Copy link
Member

rwjblue commented Apr 2, 2015

Not sure, it was not fixed by #10805.

Beta JSBin after #10805: http://emberjs.jsbin.com/rwjblue/380/edit?html,js,output

@backspace
Copy link
Author

Thanks for showing how to construct a test environment in a JSBin, @rwjblue. That’ll likely be useful for me in the future.

@blimmer
Copy link

blimmer commented Apr 12, 2015

I'm seeing strange behavior with currentUrl on 1.12.0-beta.1, too. However I still see it, even after a visit. Here's my test (I use ember-cli-mocha):

it('routes direct', function() {
  visit('/account/settings/profile');
  return andThen(function() {
    expect(currentRouteName()).to.equal('account.settings.profile');  // Passes
    expect(currentURL()).to.equal('/account/settings/profile');    // returns empty string
  });
});

Let me know if I can provide additional info.

@tremendus
Copy link

I have the same issue with #canary using Qunit

test('visiting /signup/user', function(assert) {
  visit('/signup/user');
  andThen(function() {
    assert.equal(currentURL(), '/signup/user'); // currentURL() returns empty string and fails
  });
});

@saitheexplorer
Copy link

I' m seeing this too -

test('visiting /', function (assert) {
  visit('/');

  andThen(function () {
    assert.equal(currentURL(), '/', 'Index page is at root route');
  });
});

This passes in 1.11.3, but fails in 1.12.0-beta.3.

@samcic
Copy link

samcic commented May 15, 2015

I'm having the same problem, upgrading from 1.11.3 to 1.12 (release).

@saitheexplorer
Copy link

Just tried testing again- still having it as well.

@givanse
Copy link

givanse commented May 15, 2015

@achambers @saitheexplorer @samcic "me too" comments are not helpful and will only cause the thread to be closed for owners only. Comment if you have found a workaround, a fix or a clue that will lead to the culprit.

@saitheexplorer
Copy link

@givanse Fair, but given the radio silence on what seems to be a regression (tests that passed in 1.11 no longer pass in 1.12 and changelog doesn't mention this being deprecated), my "me too" comment is an attempt to let the owners know that this is an issue that affects more people than just the OP.

Not to belabor the point, but #10850 has a pretty detailed reproduction, and there hasn't been a response there either.

Point taken though; I'll see if I can debug further and come up with some answers. Thanks.

@elskwid
Copy link
Contributor

elskwid commented May 18, 2015

@backspace I did some hunting around today and may have tracked this down. I've got a PR up at #11201. We'll see how it goes. 😄

@rwjblue
Copy link
Member

rwjblue commented May 18, 2015

Fixed by #11201. Thanks @elskwid!

@rwjblue rwjblue closed this as completed May 18, 2015
@backspace
Copy link
Author

Yes, thanks for figuring it out, @elskwid!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants