diff --git a/src/lib/template/dom-repeat.html b/src/lib/template/dom-repeat.html index 95b10ab3dd..20bca42644 100644 --- a/src/lib/template/dom-repeat.html +++ b/src/lib/template/dom-repeat.html @@ -199,7 +199,8 @@ */ renderedItemCount: { type: Number, - notify: true + notify: true, + readOnly: true }, /** @@ -450,7 +451,7 @@ // the same item. this._pool.length = 0; // Set rendered item count - this.renderedItemCount = this._instances.length; + this._setRenderedItemCount(this._instances.length); // Notify users this.fire('dom-change'); // Check to see if we need to render more items diff --git a/test/unit/dom-repeat.html b/test/unit/dom-repeat.html index 1164fd433a..72091a6671 100644 --- a/test/unit/dom-repeat.html +++ b/test/unit/dom-repeat.html @@ -3311,6 +3311,23 @@

x-repeat-chunked

assert.equal(repeater3.keyForElement(stamped1[4]), coll3.getKey(items3[2])); }); + test('renderedItemCount', function() { + var repeater1 = primitive.$.repeater1; + primitive.items = [ 'a', 'b', 'c', 'd', 'e' ]; + repeater1.render(); + assert.equal(repeater1.renderedItemCount, 5, 'renderedItemCount is incorrect'); + repeater1.renderedItemCount = 0; + assert.equal(repeater1.renderedItemCount, 5, 'renderedItemCount is writable'); + repeater1.filter = function(item) { + return (item != 'a' && item != 'e'); + } + repeater1.render(); + assert.equal(repeater1.renderedItemCount, 3, 'renderedItemCount incorrect after filter'); + // reset repeater + repeater1.filter = undefined; + repeater1.render(); + }); + test('__hideTemplateChildren__', function() { // Initially all showing var stamped1 = Polymer.dom(primitive.$.container1).querySelectorAll('*:not(template)');