Skip to content

Commit d0e55bf

Browse files
Vojta Jinamhevery
authored andcommitted
Removed $location.cancel() method (and related test)
1 parent 1cad16c commit d0e55bf

2 files changed

Lines changed: 1 addition & 24 deletions

File tree

src/services.js

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ angularServiceInject("$document", function(window){
1515

1616
angularServiceInject("$location", function(browser) {
1717
var scope = this,
18-
location = {toString:toString, update:update, updateHash: updateHash, cancel: cancel},
18+
location = {toString:toString, update:update, updateHash: updateHash},
1919
lastLocationHref = browser.getUrl(),
2020
lastLocationHash;
2121

@@ -101,19 +101,6 @@ angularServiceInject("$location", function(browser) {
101101
return location.href;
102102
}
103103

104-
/**
105-
* Cancel change of the location
106-
*
107-
* Calling update(), updateHash() or setting a property does not immediately
108-
* change the browser's url. Url is changed at the end of $eval()
109-
*
110-
* By calling this method, you can cancel the change (before end of $eval())
111-
*
112-
*/
113-
function cancel() {
114-
update(lastLocationHref);
115-
}
116-
117104
// INNER METHODS
118105

119106
/**

test/servicesSpec.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -227,16 +227,6 @@ describe("service", function(){
227227
expect(scope.$location.hash).toEqual('path?a=b');
228228
expect(scope.$location.hashSearch).toEqual({a: 'b'});
229229
expect(scope.$location.hashPath).toEqual('path');
230-
});
231-
232-
it('should not update browser if you call cancel()', function() {
233-
spyOn($browser, 'setUrl');
234-
235-
scope.$location.update('http://www.angularjs.org/a/b#a/b');
236-
scope.$location.cancel();
237-
scope.$eval();
238-
239-
expect($browser.setUrl).not.toHaveBeenCalled();
240230
});
241231
});
242232

0 commit comments

Comments
 (0)