diff options
Diffstat (limited to 'test/ng/directive/ngRepeatSpec.js')
| -rw-r--r-- | test/ng/directive/ngRepeatSpec.js | 20 | 
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ng/directive/ngRepeatSpec.js b/test/ng/directive/ngRepeatSpec.js index a85fd5ab..9dfaa404 100644 --- a/test/ng/directive/ngRepeatSpec.js +++ b/test/ng/directive/ngRepeatSpec.js @@ -77,7 +77,27 @@ describe('ngRepeat', function() {      expect(element.find('li').length).toEqual(3);      expect(element.text()).toEqual('x;y;x;');    }); +   +  it('should iterate over an array-like class', function() { +    function Collection() {} +    Collection.prototype = new Array(); +    Collection.prototype.length = 0; +    var collection = new Collection(); +    collection.push({ name: "x" }); +    collection.push({ name: "y" }); +    collection.push({ name: "z" }); + +    element = $compile( +      '<ul>' + +        '<li ng-repeat="item in items">{{item.name}};</li>' + +      '</ul>')(scope); + +    scope.items = collection; +    scope.$digest(); +    expect(element.find('li').length).toEqual(3); +    expect(element.text()).toEqual('x;y;z;'); +  });    it('should iterate over on object/map', function() {      element = $compile(  | 
