Skip to content

Commit

Permalink
Merge 9ef0563 into 752e870
Browse files Browse the repository at this point in the history
  • Loading branch information
pekam committed Jun 4, 2019
2 parents 752e870 + 9ef0563 commit da19da5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/vaadin-combo-box-data-provider-mixin.html
Expand Up @@ -156,6 +156,10 @@
if (Object.keys(this._pendingRequests).length === 0) {
this.loading = false;
}
if (page === 0 && this.__repositionOverlayDebouncer && items.length > (this.__maxRenderedItems || 0)) {
setTimeout(() => this.__repositionOverlayDebouncer.flush());
this.__maxRenderedItems = items.length;
}
}
};
this._pendingRequests[page] = callback;
Expand Down
17 changes: 17 additions & 0 deletions test/lazy-loading.html
Expand Up @@ -258,6 +258,23 @@
comboBox.open();
expect(dp).to.be.calledOnce;
});

it('should render all visible items after delayed response', done => {
const items = [...Array(10)].map((_, i) => 'item ' + i);
comboBox.dataProvider = (params, callback) => {
setTimeout(() => {
callback(items, 10);
setTimeout(() => {
const renderedTexts = Array.from(comboBox.$.overlay._selector
.querySelectorAll('vaadin-combo-box-item'))
.map(i => i.shadowRoot.querySelector('#content').innerText);
expect(renderedTexts).to.eql(items);
done();
});
}, 50);
};
comboBox.open();
});
});

describe('when selecting item', () => {
Expand Down

0 comments on commit da19da5

Please sign in to comment.