|
1 | 1 | import { expect } from '@esm-bundle/chai';
|
2 |
| -import { fixtureSync } from '@vaadin/testing-helpers'; |
| 2 | +import { fixtureSync, nextFrame } from '@vaadin/testing-helpers'; |
3 | 3 | import './not-animated-styles.js';
|
4 | 4 | import '../vaadin-combo-box.js';
|
5 |
| -import { html, render } from 'lit'; |
| 5 | +import { html, LitElement, render } from 'lit'; |
6 | 6 | import { getViewportItems } from './helpers.js';
|
7 | 7 |
|
8 | 8 | describe('lit', () => {
|
@@ -36,4 +36,41 @@ describe('lit', () => {
|
36 | 36 | expect(getViewportItems(comboBox)[0].textContent).to.equal('new-0');
|
37 | 37 | });
|
38 | 38 | });
|
| 39 | + |
| 40 | + describe('complex structure', () => { |
| 41 | + let container, comboBox, selector; |
| 42 | + |
| 43 | + class TestSlotContainer extends LitElement { |
| 44 | + render() { |
| 45 | + return html`<slot></slot> `; |
| 46 | + } |
| 47 | + } |
| 48 | + customElements.define('test-slot-container', TestSlotContainer); |
| 49 | + |
| 50 | + class TestSlottedComboComponent extends LitElement { |
| 51 | + render() { |
| 52 | + return html` |
| 53 | + <test-slot-container> |
| 54 | + <vaadin-combo-box .items="${['First', 'Second', 'Third']}"></vaadin-combo-box> |
| 55 | + </test-slot-container> |
| 56 | + `; |
| 57 | + } |
| 58 | + } |
| 59 | + customElements.define('test-slotted-combo-component', TestSlottedComboComponent); |
| 60 | + |
| 61 | + beforeEach(async () => { |
| 62 | + container = fixtureSync('<div></div>'); |
| 63 | + render(html`<test-slotted-combo-component></test-slotted-combo-component>`, container); |
| 64 | + await nextFrame(); |
| 65 | + const component = container.querySelector('test-slotted-combo-component'); |
| 66 | + comboBox = component.shadowRoot.querySelector('vaadin-combo-box'); |
| 67 | + selector = comboBox._scroller.shadowRoot.children.selector; |
| 68 | + }); |
| 69 | + |
| 70 | + it('should not show horizontal scrollbar when placed in slotted container', () => { |
| 71 | + comboBox.open(); |
| 72 | + |
| 73 | + expect(getComputedStyle(selector).position).to.equal('relative'); |
| 74 | + }); |
| 75 | + }); |
39 | 76 | });
|
0 commit comments