Removed $location.cancel() method (and related test)

This commit is contained in:
Vojta Jina 2010-10-18 19:19:49 +01:00 committed by Misko Hevery
parent 1cad16c6f9
commit d0e55bf446
2 changed files with 1 additions and 24 deletions

View file

@ -15,7 +15,7 @@ angularServiceInject("$document", function(window){
angularServiceInject("$location", function(browser) {
var scope = this,
location = {toString:toString, update:update, updateHash: updateHash, cancel: cancel},
location = {toString:toString, update:update, updateHash: updateHash},
lastLocationHref = browser.getUrl(),
lastLocationHash;
@ -101,19 +101,6 @@ angularServiceInject("$location", function(browser) {
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
/**

View file

@ -227,16 +227,6 @@ describe("service", function(){
expect(scope.$location.hash).toEqual('path?a=b');
expect(scope.$location.hashSearch).toEqual({a: 'b'});
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();
});
});