mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Make renderedItemCount readOnly & add tests.
This commit is contained in:
parent
b589f70545
commit
e39d5ba1fd
@ -199,7 +199,8 @@ Then the `observe` property should be configured as follows:
|
||||
*/
|
||||
renderedItemCount: {
|
||||
type: Number,
|
||||
notify: true
|
||||
notify: true,
|
||||
readOnly: true
|
||||
},
|
||||
|
||||
/**
|
||||
@ -450,7 +451,7 @@ Then the `observe` property should be configured as follows:
|
||||
// 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
|
||||
|
@ -3311,6 +3311,23 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
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)');
|
||||
|
Loading…
Reference in New Issue
Block a user