diff --git a/js/angular/service/collectionRepeatDataSource.js b/js/angular/service/collectionRepeatDataSource.js index f83c23e65d2..fa8c05c3477 100644 --- a/js/angular/service/collectionRepeatDataSource.js +++ b/js/angular/service/collectionRepeatDataSource.js @@ -48,14 +48,7 @@ function($cacheFactory, $parse, $rootScope) { destroy: function() { this.dimensions.length = 0; this.data = null; - forEach(this.backupItemsArray, function(item) { - this.destroyItem(item); - }, this); this.backupItemsArray.length = 0; - - forEach(this.attachedItems, function(item, key) { - this.destroyItem(item); - }, this); this.attachedItems = {}; }, calculateDataDimensions: function() { diff --git a/js/angular/service/collectionRepeatManager.js b/js/angular/service/collectionRepeatManager.js index a56d64fa7c3..e290da2ae41 100644 --- a/js/angular/service/collectionRepeatManager.js +++ b/js/angular/service/collectionRepeatManager.js @@ -78,9 +78,10 @@ function($rootScope, $timeout) { CollectionRepeatManager.prototype = { destroy: function() { - for (var i in this.renderedItems) { - this.removeItem(i); - } + this.renderedItems = {}; + this.render = angular.noop; + this.calculateDimensions = angular.noop; + this.dimensions = []; }, /* diff --git a/test/unit/angular/service/collectionDataSource.unit.js b/test/unit/angular/service/collectionDataSource.unit.js index 7023a9a62ab..1ea7475735b 100644 --- a/test/unit/angular/service/collectionDataSource.unit.js +++ b/test/unit/angular/service/collectionDataSource.unit.js @@ -70,20 +70,6 @@ describe('$collectionDataSource service', function() { }); }); - it('.destroy() should cleanup dimensions backupItemsArray and attachedItems', function() { - var source = setup(); - source.dimensions = [1,2,3]; - source.attachedItems = {0: 'a'}; - source.backupItemsArray = ['b']; - spyOn(source, 'destroyItem'); - source.destroy(); - expect(source.dimensions.length).toBe(0); - expect(source.destroyItem).toHaveBeenCalledWith('a'); - expect(source.destroyItem).toHaveBeenCalledWith('b'); - expect(source.attachedItems).toEqual({}); - expect(source.backupItemsArray).toEqual([]); - }); - it('.calculateDataDimensions()', function() { function widthGetter(scope, locals) { return locals.$index + locals.item + 'w'; diff --git a/test/unit/angular/service/collectionRepeatManager.unit.js b/test/unit/angular/service/collectionRepeatManager.unit.js index 823cd69d659..4d9176dcf6c 100644 --- a/test/unit/angular/service/collectionRepeatManager.unit.js +++ b/test/unit/angular/service/collectionRepeatManager.unit.js @@ -168,15 +168,6 @@ describe('collectionRepeatManager service', function() { }); - it('.destroy() should remove items', function() { - var manager = setup(); - spyOn(manager, 'removeItem'); - manager.renderedItems = { '1': true, '2': true }; - manager.destroy(); - expect(manager.removeItem).toHaveBeenCalledWith('1'); - expect(manager.removeItem).toHaveBeenCalledWith('2'); - }); - describe('.calculateDimensions()', function() { it('should work with 1 item per space', function() { var manager = setup();