Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
test(ng:repeat): add tests for $position for small arrays/objects
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorMinar committed Jul 13, 2011
1 parent e09a784 commit bb39d34
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/widgetsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,11 @@ describe("widget", function(){
scope.items.push('frodo');
scope.$eval();
expect(element.text()).toEqual('misko:first|shyam:middle|doug:middle|frodo:last|');

scope.items.pop();
scope.items.pop();
scope.$eval();
expect(element.text()).toEqual('misko:first|shyam:last|');
});

it('should expose iterator position as $position when iterating over objects', function() {
Expand All @@ -908,6 +913,11 @@ describe("widget", function(){
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|');

delete scope.items.doug;
delete scope.items.frodo;
scope.$eval();
expect(element.text()).toEqual('misko:m:first|shyam:s:last|');
});
});

Expand Down

0 comments on commit bb39d34

Please sign in to comment.