diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/CompilerSpec.js | 10 | ||||
| -rw-r--r-- | test/directivesSpec.js | 14 | ||||
| -rw-r--r-- | test/servicesSpec.js | 21 |
3 files changed, 23 insertions, 22 deletions
diff --git a/test/CompilerSpec.js b/test/CompilerSpec.js index 3736ff4e..1091337b 100644 --- a/test/CompilerSpec.js +++ b/test/CompilerSpec.js @@ -1,5 +1,5 @@ describe('compiler', function(){ - var compiler, textMarkup, directives, widgets, compile, log; + var compiler, markup, directives, widgets, compile, log; beforeEach(function(){ log = ""; @@ -20,10 +20,10 @@ describe('compiler', function(){ } }; - textMarkup = []; + markup = []; attrMarkup = []; widgets = extensionMap({}, 'widget'); - compiler = new Compiler(textMarkup, attrMarkup, directives, widgets); + compiler = new Compiler(markup, attrMarkup, directives, widgets); compile = function(html){ var e = jqLite("<div>" + html + "</div>"); var scope = compiler.compile(e)(e); @@ -94,7 +94,7 @@ describe('compiler', function(){ }); it('should process markup before directives', function(){ - textMarkup.push(function(text, textNode, parentNode) { + markup.push(function(text, textNode, parentNode) { if (text == 'middle') { expect(textNode.text()).toEqual(text); parentNode.attr('hello', text); @@ -126,7 +126,7 @@ describe('compiler', function(){ this.directives(true); return noop; }; - textMarkup.push(function(text, textNode, parent){ + markup.push(function(text, textNode, parent){ if (text == '{{1+2}}') parent.text('3'); }); 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('<div ng:click="clicked = true"></div>'); - scope.$eval(); - expect(scope.$get('clicked')).toBeFalsy(); + describe('ng:click', function(){ + it('should fire event', function(){ + var scope = compile('<div ng:click="clicked = true"></div>'); + 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(){ diff --git a/test/servicesSpec.js b/test/servicesSpec.js index 91538703..ffd01267 100644 --- a/test/servicesSpec.js +++ b/test/servicesSpec.js @@ -91,7 +91,7 @@ describe("service", function(){ scope.$location.hashPath = 'page=http://path'; scope.$location.hashSearch = {k:'a=b'}; - expect(scope.$location.toString()).toEqual('http://host:123/p/a/t/h.html?query=value#page=http://path?k=a%3Db'); + expect(scope.$location.toString()).toEqual('http://host:123/p/a/t/h.html?query=value#page%3Dhttp%3A//path?k=a%3Db'); }); it('should parse file://', function(){ @@ -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('<div>'); var log = ''; @@ -136,15 +144,6 @@ describe("service", function(){ scope.$eval(); expect(log).toEqual('/abc;'); }); - - 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'); - }); - }); describe("$invalidWidgets", function(){ |
