Skip to content

Commit 8ec2a8c

Browse files
fix: do not throw when combo-box is templatized (#5330) (#5331)
Co-authored-by: Tomi Virkki <tomivirkki@users.noreply.github.com>
1 parent e896534 commit 8ec2a8c

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

packages/combo-box/src/vaadin-combo-box-scroller.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,9 @@ export class ComboBoxScroller extends PolymerElement {
169169
}
170170

171171
requestContentUpdate() {
172-
this.__virtualizer.update();
172+
if (this.__virtualizer) {
173+
this.__virtualizer.update();
174+
}
173175
}
174176

175177
scrollIntoView(index) {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { expect } from '@esm-bundle/chai';
2+
import './not-animated-styles.js';
3+
import '../vaadin-combo-box.js';
4+
import { html } from '@polymer/polymer';
5+
import { templatize } from '@polymer/polymer/lib/utils/templatize.js';
6+
7+
it('should not throw when templatized', () => {
8+
// Use Templatizer to create a new combo-box instance
9+
const TemplateClass = templatize(html`<vaadin-combo-box></vaadin-combo-box>`);
10+
const instance = new TemplateClass();
11+
const comboBox = instance.root.querySelector('vaadin-combo-box');
12+
// Add the new combo-box instance to the document body
13+
expect(() => document.body.appendChild(comboBox)).not.to.throw();
14+
15+
// Clean up
16+
comboBox.remove();
17+
});

0 commit comments

Comments
 (0)