From d717020911a350a5ea3c0a985c57d56c8fcad607 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 2 Apr 2010 11:10:36 -0700 Subject: widgets now work properly --- test/servicesSpec.js | 28 +++++++++++++++++++++------- test/widgetsSpec.js | 10 +++++----- 2 files changed, 26 insertions(+), 12 deletions(-) (limited to 'test') 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'); }); }); diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index 6123e229..6c47e5dd 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -114,23 +114,23 @@ describe("input widget", function(){ it('should type="checkbox"', function(){ compile(''); - expect(scope.$get('checkbox')).toEqual(true); + expect(scope.checkbox).toEqual(true); element.click(); - expect(scope.$get('checkbox')).toEqual(false); - expect(scope.$get('action')).toEqual(true); + expect(scope.checkbox).toEqual(false); + expect(scope.action).toEqual(true); element.click(); - expect(scope.$get('checkbox')).toEqual(true); + expect(scope.checkbox).toEqual(true); }); it('should type="radio"', function(){ compile('