diff options
| author | Misko Hevery | 2010-04-02 11:10:36 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-04-02 11:10:36 -0700 |
| commit | d717020911a350a5ea3c0a985c57d56c8fcad607 (patch) | |
| tree | 0b0a9f14cdfdcdf0dfb4c3fd607daf5ab9f9901d /test/servicesSpec.js | |
| parent | 85f13d602e31424b2e2d18172872f14a24c31135 (diff) | |
| download | angular.js-d717020911a350a5ea3c0a985c57d56c8fcad607.tar.bz2 | |
widgets now work properly
Diffstat (limited to 'test/servicesSpec.js')
| -rw-r--r-- | test/servicesSpec.js | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/test/servicesSpec.js b/test/servicesSpec.js index 88cbc947..dec4550f 100644 --- a/test/servicesSpec.js +++ b/test/servicesSpec.js @@ -14,21 +14,35 @@ describe("services", function(){ }); it("should inject $location", function(){ - scope.$location('http://host:1234/p/a/t/h?query=value#path?key=value'); - expect(scope.$location.href).toEqual("http://host:123/p/a/t/h?query=value#path?key=value"); + scope.$location('http://host:123/p/a/t/h.html?query=value#path?key=value'); + expect(scope.$location.href).toEqual("http://host:123/p/a/t/h.html?query=value#path?key=value"); expect(scope.$location.protocol).toEqual("http"); expect(scope.$location.host).toEqual("host"); - expect(scope.$location.port).toEqual("1234"); - expect(scope.$location.path).toEqual("/p/a/t/h"); + expect(scope.$location.port).toEqual("123"); + expect(scope.$location.path).toEqual("/p/a/t/h.html"); expect(scope.$location.search).toEqual({query:'value'}); expect(scope.$location.hash).toEqual('path?key=value'); expect(scope.$location.hashPath).toEqual('path'); expect(scope.$location.hashSearch).toEqual({key:'value'}); - scope.$anchor.path = 'page=http://path'; - scope.$anchor.param = {k:'a=b'}; + scope.$location.hashPath = 'page=http://path'; + scope.$location.hashSearch = {k:'a=b'}; - expect(scope.$anchor()).toEqual('page=http://path?k=a%3Db'); + expect(scope.$location()).toEqual('http://host:123/p/a/t/h.html?query=value#path?key=valuepage=http://path?k=a%3Db'); + }); + + it('should parse file://', function(){ + scope.$location('file:///Users/Shared/misko/work/angular.js/scenario/widgets.html'); + expect(scope.$location.href).toEqual("file:///Users/Shared/misko/work/angular.js/scenario/widgets.html"); + expect(scope.$location.protocol).toEqual("file"); + expect(scope.$location.host).toEqual(""); + expect(scope.$location.port).toEqual(null); + expect(scope.$location.path).toEqual("/Users/Shared/misko/work/angular.js/scenario/widgets.html"); + expect(scope.$location.search).toEqual({}); + expect(scope.$location.hash).toEqual(''); + expect(scope.$location.hashPath).toEqual(''); + expect(scope.$location.hashSearch).toEqual({}); + expect(scope.$location()).toEqual('file:///Users/Shared/misko/work/angular.js/scenario/widgets.html'); }); }); |
