mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
fix($location): back-button should fire $locationChangeStart
Before $locationChangeStart event is not broadcast when pressing the back-button on the browser. Closes #2109
This commit is contained in:
committed by
Pete Bacon Darwin
parent
660605bdb8
commit
dc9a580617
@@ -1237,7 +1237,7 @@ describe('$location', function() {
|
||||
expect($location.url()).toEqual('');
|
||||
|
||||
$rootScope.$on('$locationChangeStart', function(event, newUrl, oldUrl) {
|
||||
throw Error('there is no before when user enters URL directly to browser');
|
||||
$log.info('start', newUrl, oldUrl);
|
||||
});
|
||||
$rootScope.$on('$locationChangeSuccess', function(event, newUrl, oldUrl) {
|
||||
$log.info('after', newUrl, oldUrl);
|
||||
@@ -1247,6 +1247,8 @@ describe('$location', function() {
|
||||
$browser.url('http://server/#/somePath');
|
||||
$browser.poll();
|
||||
|
||||
expect($log.info.logs.shift()).
|
||||
toEqual(['start', 'http://server/#/somePath', 'http://server/']);
|
||||
expect($log.info.logs.shift()).
|
||||
toEqual(['after', 'http://server/#/somePath', 'http://server/']);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user