From 2a12f7dcaa078e1d6c3b5092e62dd5f404b8c3e4 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 12 Apr 2011 13:40:23 -0700 Subject: Added nextUid() function for unified way of generating IDs in angular --- test/AngularSpec.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/AngularSpec.js') diff --git a/test/AngularSpec.js b/test/AngularSpec.js index b58705cc..4ab14580 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -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; + } + }); + }); + }); -- cgit v1.2.3