Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

$location.path should not contain / prefix #234

Closed
IgorMinar opened this issue Jan 14, 2011 · 2 comments
Closed

$location.path should not contain / prefix #234

IgorMinar opened this issue Jan 14, 2011 · 2 comments
Milestone

Comments

@IgorMinar
Copy link
Contributor

why on earth does $location.path contain the / prefix?

$locaiton.update('http://foo:23/bar');
$location.path = 'newPath';
scope.eval();
expect($location.href).toBe('http://foo:23/newPath');

this fails because the href is http://foo:23newPath

@mhevery
Copy link
Contributor

mhevery commented Jan 14, 2011

I don't understand this error. The test is correct. path has no prefix and the formatter should be smart enough to add it there if it is needed.

@IgorMinar
Copy link
Contributor Author

heh.. interesting.. I drafted the test without actually running it and exposed another bug by coincidence.

it('should corectly prefix path with /', function() {
  $location.update('http://foo:23/bar');
  scope.$eval();
  $location.path = 'newPath';
  scope.$eval();
  expect($location.href).toBe('http://foo:23/newPath');
});

it('should sync() upon update', function() {
  $location.update('http://foo:23/bar');
  $location.path = 'newPath';
  scope.$eval();
  expect($location.href).toBe('http://foo:23/newPath');
});

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

No branches or pull requests

3 participants