Added nextUid() function for unified way of generating IDs in angular

This commit is contained in:
Misko Hevery
2011-04-12 13:40:23 -07:00
parent 20ce797906
commit 2a12f7dcaa
2 changed files with 47 additions and 0 deletions

View File

@@ -582,4 +582,20 @@ describe('angular', function(){
});
}
});
describe('nextUid()', function(){
it('should return new id per call', function(){
var seen = {};
var count = 100;
while(count--) {
var current = nextUid();
expect(current.match(/[\d\w]+/)).toBeTruthy();
expect(seen[current]).toBeFalsy();
seen[current] = true;
}
});
});
});