diff options
| author | Rado Kirov | 2012-09-21 18:57:22 -0700 |
|---|---|---|
| committer | Igor Minar | 2012-11-26 23:24:39 +0100 |
| commit | fc781560a341c804b02c7efd30c6d3010206401c (patch) | |
| tree | 48de9757da5982e49eab1d79b58bd985a3726a27 /test/ng/routeSpec.js | |
| parent | c9199ee6634af6b960524d91bdae706860a49d0c (diff) | |
| download | angular.js-fc781560a341c804b02c7efd30c6d3010206401c.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.js | 13 |
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]); }); }); }); |
