correct size() impl for object's w/ 'length' prop

the original implementation returned incorrect value value for
objects with 'length' property.
This commit is contained in:
Igor Minar
2011-03-27 16:19:03 -07:00
parent 96a1df192a
commit a4863d5244
2 changed files with 14 additions and 8 deletions

View File

@@ -133,6 +133,10 @@ describe('angular', function(){
expect(size('')).toBe(0);
expect(size('abc')).toBe(3);
});
it('should not rely on length property of an object to determine its size', function() {
expect(size({length:99})).toBe(1);
});
});