From 2a30a02f015dd54846bb62d1f05e82b3cf76ef9f Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 27 Jul 2010 15:54:50 -0700 Subject: fix preventDefault for events --- test/directivesSpec.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/directivesSpec.js b/test/directivesSpec.js index 8a7da41d..278f9c4c 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -160,13 +160,15 @@ describe("directives", function(){ expect(scope.$get('count')).toEqual(1); }); - it('should ng:click', function(){ - var scope = compile('
'); - scope.$eval(); - expect(scope.$get('clicked')).toBeFalsy(); + describe('ng:click', function(){ + it('should fire event', function(){ + var scope = compile(''); + scope.$eval(); + expect(scope.$get('clicked')).toBeFalsy(); - element.trigger('click'); - expect(scope.$get('clicked')).toEqual(true); + element.trigger('click'); + expect(scope.$get('clicked')).toEqual(true); + }); }); it('should ng:class', function(){ -- cgit v1.2.3 From 1b768b84439e725010acc943ebfda462e49d3704 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 29 Jul 2010 12:50:14 -0700 Subject: refactored $location service so that it correctly updates under all conditions --- test/servicesSpec.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/servicesSpec.js b/test/servicesSpec.js index 91538703..cb5c9b30 100644 --- a/test/servicesSpec.js +++ b/test/servicesSpec.js @@ -106,7 +106,7 @@ describe("service", function(){ expect(scope.$location.hashPath).toEqual(''); expect(scope.$location.hashSearch).toEqual({}); - expect(scope.$location.toString()).toEqual('file:///Users/Shared/misko/work/angular.js/scenario/widgets.html#'); + expect(scope.$location.toString()).toEqual('file:///Users/Shared/misko/work/angular.js/scenario/widgets.html'); }); it('should update url on hash change', function(){ @@ -123,6 +123,14 @@ describe("service", function(){ expect(scope.$location.hash).toEqual('?a=b'); }); + it("should parse url which contains - in host", function(){ + scope.$location.parse('http://a-b1.c-d.09/path'); + expect(scope.$location.href).toEqual('http://a-b1.c-d.09/path'); + expect(scope.$location.protocol).toEqual('http'); + expect(scope.$location.host).toEqual('a-b1.c-d.09'); + expect(scope.$location.path).toEqual('/path'); + }); + it('should update hash before any processing', function(){ var scope = compile('