aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorIgor Minar2011-01-31 23:25:42 -0800
committerIgor Minar2011-02-01 09:35:18 -0800
commitc648fee5c2c46cbd2ea8b5bd4cec8005f182db1c (patch)
tree56e26a842612cf7e050737d3875b7855318d3b9a /test
parent9462c78fbf0896f0939c1bf3eb44a3f4f503f0a6 (diff)
downloadangular.js-c648fee5c2c46cbd2ea8b5bd4cec8005f182db1c.tar.bz2
fix $location to handle updates to empty hash well
Diffstat (limited to 'test')
-rw-r--r--test/servicesSpec.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/servicesSpec.js b/test/servicesSpec.js
index 02e874fe..f7151dbc 100644
--- a/test/servicesSpec.js
+++ b/test/servicesSpec.js
@@ -298,6 +298,12 @@ describe("service", function(){
$location.update('http://www.angularjs.org/index.php#');
expect($location.href).toEqual('http://www.angularjs.org/index.php');
});
+
+ it('should clear hash when updating to hash-less URL', function() {
+ $location.update('http://server');
+ expect($location.href).toBe('http://server');
+ expect($location.hash).toBe('');
+ });
});
@@ -320,6 +326,17 @@ describe("service", function(){
expect($location.hashSearch).toEqual({a: 'b'});
expect($location.hashPath).toEqual('path');
});
+
+ it('should update href and hash when updating to empty string', function() {
+ $location.updateHash('');
+ expect($location.href).toBe('http://server');
+ expect($location.hash).toBe('');
+
+ scope.$eval();
+
+ expect($location.href).toBe('http://server');
+ expect($location.hash).toBe('');
+ });
});
});