mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +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) {
|
||||
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
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue