From 99f25050a34a0f0e2b0bdc63a55f38097f7098db Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Sun, 31 Oct 2010 02:11:50 +0200 Subject: Fixing issue #98 (infinite loop when location hash set empty) Added tests and fixed the issue. Closes #98 --- test/servicesSpec.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/servicesSpec.js b/test/servicesSpec.js index 276f5de9..f4d9aabe 100644 --- a/test/servicesSpec.js +++ b/test/servicesSpec.js @@ -207,6 +207,18 @@ describe("service", function(){ expect(scope.$location.hashSearch).toEqual({a: 'b'}); expect(scope.$location.hashPath).toEqual('path'); }); + + it('should remove # if hash is empty', function() { + scope.$location.update('http://www.angularjs.org/index.php#'); + expect(scope.$location.href).toEqual('http://www.angularjs.org/index.php'); + }); + + it('should not change browser\'s url with empty hash', function() { + $browser.setUrl('http://www.angularjs.org/index.php#'); + spyOn($browser, 'setUrl'); + $browser.poll(); + expect($browser.setUrl).not.toHaveBeenCalled(); + }); }); describe("$invalidWidgets", function(){ -- cgit v1.2.3