diff --git a/src/components/virtualRepeat/virtualRepeater.js b/src/components/virtualRepeat/virtualRepeater.js index 71357f9c44f..e86b800ccbc 100644 --- a/src/components/virtualRepeat/virtualRepeater.js +++ b/src/components/virtualRepeat/virtualRepeater.js @@ -365,6 +365,12 @@ function VirtualRepeatController($scope, $element, $attrs, $browser, $document, /** @type {number} Most recently seen length of items. */ this.itemsLength = 0; + /** + * @type {!Function} Unwatch callback for item size (when md-items-size is + * not specified), or angular.noop otherwise. + */ + this.unwatchItemSize_ = angular.noop; + /** * Presently rendered blocks by repeat index. * @type {Object', function() { expect(container[0].offsetWidth).toBe(2 * ITEM_SIZE); }); + it('should measure item size after data has loaded (no md-item-size)', function() { + repeater.removeAttr('md-item-size'); + createRepeater(); + scope.$apply(); + $$rAF.flush(); + + expect(getRepeated().length).toBe(0); + + scope.items = createItems(NUM_ITEMS); + scope.$apply(); + $$rAF.flush(); + + var numItemRenderers = VERTICAL_PX / ITEM_SIZE + VirtualRepeatController.NUM_EXTRA; + expect(getRepeated().length).toBe(numItemRenderers); + }); + /** * Facade to access transform properly even when jQuery is used; * since jQuery's css function is obtaining the computed style (not wanted)