diff options
| author | Misko Hevery | 2010-03-22 15:46:34 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-03-22 15:46:34 -0700 |
| commit | b4561ff951ff452e55e820f6f8344dc2668cfd90 (patch) | |
| tree | ca454e5edcf0fbe04a32ff9c950cce9be701e43b /test | |
| parent | 84552f7f8ac3f39c4dbd7d946ae2938d63302840 (diff) | |
| download | angular.js-b4561ff951ff452e55e820f6f8344dc2668cfd90.tar.bz2 | |
ng-repeat works
Diffstat (limited to 'test')
| -rw-r--r-- | test/directivesSpec.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/test/directivesSpec.js b/test/directivesSpec.js index 176f9e70..2cee20d1 100644 --- a/test/directivesSpec.js +++ b/test/directivesSpec.js @@ -66,6 +66,20 @@ describe("directives", function(){ expect(element.text()).toEqual('brad;'); }); - it('should ng-repeat over object', function(){}); - it('should error on wrong parsing of ng-repeat', function(){}); + it('should ng-repeat over object', function(){ + var scope = compile('<ul><li ng-repeat="(key, value) in items" ng-bind="key + \':\' + value + \';\' "></li></ul>'); + scope.set('items', {misko:'swe', shyam:'set'}); + scope.updateView(); + expect(element.text()).toEqual('misko:swe;shyam:set;'); + }); + + it('should error on wrong parsing of ng-repeat', function(){ + var scope = compile('<ul><li ng-repeat="i dont parse"></li></ul>'); + var log = ""; + element.eachNode(function(li){ + log += li.attr('ng-error') + ';'; + log += li.hasClass('ng-exception') + ';'; + }); + expect(log).toEqual("\"Expected ng-repeat in form of 'item in collection' but got 'i dont parse'.\";true;"); + }); }); |
