From bf8013ad57ce30639bb37e7c0b8cf99cab8be650 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Fri, 4 Feb 2011 09:11:18 -0800 Subject: $location.updateHash should not preserve hashSearch when hashSearch is undefined --- test/servicesSpec.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') diff --git a/test/servicesSpec.js b/test/servicesSpec.js index 0876f986..b3f6ec10 100644 --- a/test/servicesSpec.js +++ b/test/servicesSpec.js @@ -314,6 +314,14 @@ describe("service", function(){ expect($location.hashPath).toEqual('path'); }); + it('should reset hashSearch when updating with a single string', function() { + $location.updateHash({foo:'bar'}); //set some initial state for hashSearch + + $location.updateHash('path'); + expect($location.hashPath).toEqual('path'); + expect($location.hashSearch).toEqual({}); + }); + it('should accept single object argument to update search', function() { $location.updateHash({a: 'b'}); expect($location.hash).toEqual('?a=b'); -- cgit v1.2.3