mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
Added nextUid() function for unified way of generating IDs in angular
This commit is contained in:
@@ -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;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user