Skip to content

Commit

Permalink
Merge 4bcb678 into febfcf6
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivirkki committed Oct 15, 2018
2 parents febfcf6 + 4bcb678 commit 7d8562b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 7 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,13 @@
}
}

_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) {
this.filteredItems = Array.from(new Array(size))
.map((_, index) => {
return (this.filteredItems && this.filteredItems[index] !== undefined)
? this.filteredItems[index]
: new Vaadin.ComboBoxPlaceholder();
});
}

_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 7d8562b

Please sign in to comment.