Skip to content

Commit

Permalink
Close the overlay if size is 0 after data provider callback (#752)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomivirkki authored Dec 11, 2018
1 parent 8192d24 commit 6a94726
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/vaadin-combo-box-data-provider-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@
if (Object.keys(this._pendingRequests).length === 0) {
this.loading = false;
}
if (!this.size) {
this.opened = false;
}
}
};
this._pendingRequests[page] = callback;
Expand Down
6 changes: 6 additions & 0 deletions test/lazy-loading.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@
expect(comboBox.items).to.be.undefined;
});

it('should close if empty result set is received', () => {
comboBox.dataProvider = (params, cb) => cb([], 0);
comboBox.opened = true;
expect(comboBox.opened).to.be.false;
});

describe('when open', () => {
beforeEach(() => comboBox.opened = true);

Expand Down

0 comments on commit 6a94726

Please sign in to comment.