From 522ec1a9ec10e1fece3e5e855c1d7ef9770a8efc Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 17 Nov 2010 22:32:35 -0800 Subject: move attribute widgets to widgets.js file - move @ng:repeat to widgets.js and its specs to widgetsSpecs.js - move @ng:non-bindable to widgets.js and its specs to widgetsSpecs.js - make widget.template suitable for attribute widgets - fix up the js docs for attribute widgets --- test/directivesSpec.js | 79 +------------------------------------------------- 1 file changed, 1 insertion(+), 78 deletions(-) (limited to 'test/directivesSpec.js') diff --git a/test/directivesSpec.js b/test/directivesSpec.js index 4b949fcb..b70067ba 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -1,4 +1,4 @@ -describe("directives", function(){ +describe("directive", function(){ var compile, model, element; @@ -128,83 +128,6 @@ describe("directives", function(){ expect(input.checked).toEqual(true); }); - it('should ng:non-bindable', function(){ - var scope = compile('
'); - scope.$set('name', 'misko'); - scope.$eval(); - expect(element.text()).toEqual(''); - }); - - - describe('ng:repeat', function() { - - it('should ng:repeat over array', function(){ - var scope = compile(''); - - Array.prototype.extraProperty = "should be ignored"; - scope.items = ['misko', 'shyam']; - scope.$eval(); - expect(element.text()).toEqual('misko;shyam;'); - delete Array.prototype.extraProperty; - - scope.items = ['adam', 'kai', 'brad']; - scope.$eval(); - expect(element.text()).toEqual('adam;kai;brad;'); - - scope.items = ['brad']; - scope.$eval(); - expect(element.text()).toEqual('brad;'); - }); - - it('should ng:repeat over object', function(){ - var scope = compile(''); - scope.$set('items', {misko:'swe', shyam:'set'}); - scope.$eval(); - expect(element.text()).toEqual('misko:swe;shyam:set;'); - }); - - it('should error on wrong parsing of ng:repeat', function(){ - var scope = compile(''); - var log = ""; - log += element.attr('ng-exception') + ';'; - log += element.hasClass('ng-exception') + ';'; - expect(log.match(/Expected ng:repeat in form of 'item in collection' but got 'i dont parse'./)).toBeTruthy(); - }); - - it('should expose iterator offset as $index when iterating over arrays', function() { - var scope = compile(''); - scope.items = ['misko', 'shyam', 'frodo']; - scope.$eval(); - expect(element.text()).toEqual('misko0|shyam1|frodo2|'); - }); - - it('should expose iterator offset as $index when iterating over objects', function() { - var scope = compile(''); - scope.items = {'misko':'m', 'shyam':'s', 'frodo':'f'}; - scope.$eval(); - expect(element.text()).toEqual('misko:m0|shyam:s1|frodo:f2|'); - }); - - it('should expose iterator position as $position when iterating over arrays', function() { - var scope = compile(''); - scope.items = ['misko', 'shyam', 'doug', 'frodo']; - scope.$eval(); - expect(element.text()).toEqual('misko:first|shyam:middle|doug:middle|frodo:last|'); - }); - - it('should expose iterator position as $position when iterating over objects', function() { - var scope = compile(''); - scope.items = {'misko':'m', 'shyam':'s', 'doug':'d', 'frodo':'f'}; - scope.$eval(); - expect(element.text()).toEqual('misko:m:first|shyam:s:middle|doug:d:middle|frodo:f:last|'); - }); - }); - - it('should ng:watch', function(){ var scope = compile('
'); scope.$eval(); -- cgit v1.2.3