mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-14 17:53:11 +00:00
Removed $location.cancel() method (and related test)
This commit is contained in:
parent
1cad16c6f9
commit
d0e55bf446
2 changed files with 1 additions and 24 deletions
|
|
@ -15,7 +15,7 @@ angularServiceInject("$document", function(window){
|
||||||
|
|
||||||
angularServiceInject("$location", function(browser) {
|
angularServiceInject("$location", function(browser) {
|
||||||
var scope = this,
|
var scope = this,
|
||||||
location = {toString:toString, update:update, updateHash: updateHash, cancel: cancel},
|
location = {toString:toString, update:update, updateHash: updateHash},
|
||||||
lastLocationHref = browser.getUrl(),
|
lastLocationHref = browser.getUrl(),
|
||||||
lastLocationHash;
|
lastLocationHash;
|
||||||
|
|
||||||
|
|
@ -101,19 +101,6 @@ angularServiceInject("$location", function(browser) {
|
||||||
return location.href;
|
return location.href;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Cancel change of the location
|
|
||||||
*
|
|
||||||
* Calling update(), updateHash() or setting a property does not immediately
|
|
||||||
* change the browser's url. Url is changed at the end of $eval()
|
|
||||||
*
|
|
||||||
* By calling this method, you can cancel the change (before end of $eval())
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function cancel() {
|
|
||||||
update(lastLocationHref);
|
|
||||||
}
|
|
||||||
|
|
||||||
// INNER METHODS
|
// INNER METHODS
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -227,16 +227,6 @@ describe("service", function(){
|
||||||
expect(scope.$location.hash).toEqual('path?a=b');
|
expect(scope.$location.hash).toEqual('path?a=b');
|
||||||
expect(scope.$location.hashSearch).toEqual({a: 'b'});
|
expect(scope.$location.hashSearch).toEqual({a: 'b'});
|
||||||
expect(scope.$location.hashPath).toEqual('path');
|
expect(scope.$location.hashPath).toEqual('path');
|
||||||
});
|
|
||||||
|
|
||||||
it('should not update browser if you call cancel()', function() {
|
|
||||||
spyOn($browser, 'setUrl');
|
|
||||||
|
|
||||||
scope.$location.update('http://www.angularjs.org/a/b#a/b');
|
|
||||||
scope.$location.cancel();
|
|
||||||
scope.$eval();
|
|
||||||
|
|
||||||
expect($browser.setUrl).not.toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue