Skip to content

Commit

Permalink
fix: do not throw when calling render() before first open (#781)
Browse files Browse the repository at this point in the history
  • Loading branch information
Haprog authored and web-padawan committed Mar 13, 2019
1 parent ecc226e commit e6c299d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/vaadin-combo-box-mixin.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,9 @@
* Manually invoke existing renderer.
*/
render() {
this.$.overlay._selector.querySelectorAll('vaadin-combo-box-item').forEach(item => item._render());
if (this.$.overlay._selector) {
this.$.overlay._selector.querySelectorAll('vaadin-combo-box-item').forEach(item => item._render());
}
}

_setTemplateFromNodes(nodes) {
Expand Down
4 changes: 4 additions & 0 deletions test/item-renderer.html
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
comboBox.render();
expect(comboBox.renderer.callCount).to.be.equal(renderedCount * 2);
});

it('should not throw if render() called before opening', () => {
expect(() => comboBox.render()).not.to.throw(Error);
});
});

describe('with template', () => {
Expand Down

0 comments on commit e6c299d

Please sign in to comment.