import '@lion/select/define'; import { aTimeout, expect, fixture } from '@open-wc/testing'; import { html } from 'lit/static-html.js'; /** * @typedef {import('../src/LionSelect').LionSelect} LionSelect */ describe('lion-select', () => { it('can preselect an option', async () => { const lionSelect = await fixture(html` `); expect(lionSelect.querySelector('select')?.value).to.equal('nr2'); }); it('sets the values correctly based on the option value and view value', async () => { const lionSelect = /** @type {LionSelect} */ ( await fixture(html` `) ); expect(lionSelect.serializedValue).to.equal('nr2'); expect(lionSelect.formattedValue).to.equal('Item 2'); lionSelect.modelValue = 'nr1'; await aTimeout; expect(lionSelect.serializedValue).to.equal('nr1'); expect(lionSelect.formattedValue).to.equal('Item 1'); lionSelect.modelValue = 'nr3'; await aTimeout; expect(lionSelect.serializedValue).to.equal('nr3'); expect(lionSelect.formattedValue).to.equal(''); }); it('is accessible', async () => { const lionSelect = await fixture(html` `); await expect(lionSelect).to.be.accessible(); }); });