aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/routeSpec.js
diff options
context:
space:
mode:
authorRado Kirov2012-09-21 18:57:22 -0700
committerIgor Minar2012-11-26 23:21:02 +0100
commita32bc40fd75ca46e3581ad7a6e3a24a31df6e266 (patch)
tree7f913cd56637c896e23b7b830d2db3ade0483f12 /test/ng/routeSpec.js
parentcfe13b5dac3d1260400bb55194f2bc27169fd360 (diff)
downloadangular.js-a32bc40fd75ca46e3581ad7a6e3a24a31df6e266.tar.bz2
fix($location): reset $location.$$replace with every watch call
Closes #1111
Diffstat (limited to 'test/ng/routeSpec.js')
-rw-r--r--test/ng/routeSpec.js13
1 files changed, 4 insertions, 9 deletions
diff --git a/test/ng/routeSpec.js b/test/ng/routeSpec.js
index 0e98be5f..52fffa40 100644
--- a/test/ng/routeSpec.js
+++ b/test/ng/routeSpec.js
@@ -560,20 +560,15 @@ describe('$route', function() {
$routeProvider.when('/bar/:id', {templateUrl: 'bar.html'});
$routeProvider.when('/foo/:id/:extra', {redirectTo: '/bar/:id'});
});
- inject(function($route, $location, $rootScope) {
- var replace;
-
- $rootScope.$on('$locationChangeStart', function(event, newUrl, oldUrl) {
- if (oldUrl == 'http://server/#/foo/id3/eId') {
- replace = $location.$$replace;
- }
- });
+ inject(function($browser, $route, $location, $rootScope) {
+ var $browserUrl = spyOnlyCallsWithArgs($browser, 'url').andCallThrough();
$location.path('/foo/id3/eId');
$rootScope.$digest();
expect($location.path()).toEqual('/bar/id3');
- expect(replace).toBe(true);
+ expect($browserUrl.mostRecentCall.args)
+ .toEqual(['http://server/#/bar/id3?extra=eId', true]);
});
});
});