From 61f2767ce65562257599649d9eaf9da08f321655 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Tue, 19 Mar 2013 22:27:27 -0700 Subject: feat(ngRepeat): add support for custom tracking of items BREAKING CHANGE: It is considered an error to have two items produce the same track by key. (This was tolerated before.) --- test/ApiSpecs.js | 37 ----- test/ng/directive/ngClassSpec.js | 2 +- test/ng/directive/ngRepeatSpec.js | 322 ++++++++++++++++++++------------------ 3 files changed, 175 insertions(+), 186 deletions(-) (limited to 'test') diff --git a/test/ApiSpecs.js b/test/ApiSpecs.js index 1e52cf44..12de39d0 100644 --- a/test/ApiSpecs.js +++ b/test/ApiSpecs.js @@ -23,42 +23,5 @@ describe('api', function() { expect(map.get('c')).toBe(undefined); }); }); - - - describe('HashQueueMap', function() { - it('should do basic crud with collections', function() { - var map = new HashQueueMap(); - map.push('key', 'a'); - map.push('key', 'b'); - expect(map[hashKey('key')]).toEqual(['a', 'b']); - expect(map.peek('key')).toEqual('a'); - expect(map[hashKey('key')]).toEqual(['a', 'b']); - expect(map.shift('key')).toEqual('a'); - expect(map.peek('key')).toEqual('b'); - expect(map[hashKey('key')]).toEqual(['b']); - expect(map.shift('key')).toEqual('b'); - expect(map.shift('key')).toEqual(undefined); - expect(map[hashKey('key')]).toEqual(undefined); - }); - - it('should support primitive and object keys', function() { - var obj1 = {}, - obj2 = {}; - - var map = new HashQueueMap(); - map.push(obj1, 'a1'); - map.push(obj1, 'a2'); - map.push(obj2, 'b'); - map.push(1, 'c'); - map.push(undefined, 'd'); - map.push(null, 'e'); - - expect(map[hashKey(obj1)]).toEqual(['a1', 'a2']); - expect(map[hashKey(obj2)]).toEqual(['b']); - expect(map[hashKey(1)]).toEqual(['c']); - expect(map[hashKey(undefined)]).toEqual(['d']); - expect(map[hashKey(null)]).toEqual(['e']); - }); - }); }); diff --git a/test/ng/directive/ngClassSpec.js b/test/ng/directive/ngClassSpec.js index 69afef7a..d4bd76fe 100644 --- a/test/ng/directive/ngClassSpec.js +++ b/test/ng/directive/ngClassSpec.js @@ -249,7 +249,7 @@ describe('ngClass', function() { it('should update ngClassOdd/Even when model is changed by filtering', inject(function($rootScope, $compile) { element = $compile('