import '../../../dist/shoelace.js'; import { aTimeout, expect, fixture, html, waitUntil } from '@open-wc/testing'; import sinon from 'sinon'; import type SlOption from './option.js'; describe('', () => { it('passes accessibility test', async () => { const el = await fixture(html` Option 1 Option 2 Option 3 Disabled `); await expect(el).to.be.accessible(); }); it('default properties', async () => { const el = await fixture(html` Test `); expect(el.value).to.equal(''); expect(el.disabled).to.be.false; expect(el.getAttribute('aria-disabled')).to.equal('false'); }); it('changes aria attributes', async () => { const el = await fixture(html` Test `); el.disabled = true; await aTimeout(100); expect(el.getAttribute('aria-disabled')).to.equal('true'); }); it('emits the slotchange event when the label changes', async () => { const el = await fixture(html` Text `); const slotChangeHandler = sinon.spy(); el.addEventListener('slotchange', slotChangeHandler); el.textContent = 'New Text'; await waitUntil(() => slotChangeHandler.calledOnce); expect(slotChangeHandler).to.have.been.calledOnce; }); it('should convert non-string values to string', async () => { const el = await fixture(html` Text `); // @ts-expect-error - intentional el.value = 10; await el.updateComplete; expect(el.value).to.equal('10'); }); it('should escape HTML when calling getTextLabel()', async () => { const el = await fixture(html` Option `); expect(el.getTextLabel()).to.equal('Option'); }); });