Skip to content

Commit

Permalink
Merge 85a2fc0 into febfcf6
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivirkki committed Oct 15, 2018
2 parents febfcf6 + 85a2fc0 commit fbd2c84
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/vaadin-combo-box-data-provider-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@
}
}

_sizeChanged(size) {
const filteredItems = this.filteredItems || [];
filteredItems.length = size || 0;
this.filteredItems = new Array(...filteredItems).map(item => {
return item !== undefined ? item : new Vaadin.ComboBoxPlaceholder();
});
_sizeChanged(size = 0) {
const filteredItems = (this.filteredItems || []).slice(0);
for (let i = 0; i < size; i++) {
filteredItems[i] = filteredItems[i] !== undefined ? filteredItems[i] : new Vaadin.ComboBoxPlaceholder();
}
this.filteredItems = filteredItems;
}

_pageSizeChanged(pageSize, oldPageSize) {
Expand Down
4 changes: 4 additions & 0 deletions test/lazy-loading.html
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@
expect(spyDataProvider).to.be.calledOnce;
});

it('should not throw with large size', () => {
expect(() => comboBox.size = 500000).not.to.throw(Error);
});

it('should throw if set after items', () => {
comboBox.items = ['foo'];
function setDataProvider() {
Expand Down

0 comments on commit fbd2c84

Please sign in to comment.