diff --git a/src/components/select/select.test.ts b/src/components/select/select.test.ts new file mode 100644 index 000000000..0d676fb33 --- /dev/null +++ b/src/components/select/select.test.ts @@ -0,0 +1,24 @@ +import { expect, fixture, html, waitUntil } from '@open-wc/testing'; +import sinon from 'sinon'; + +import '../../../dist/shoelace.js'; +import type SlSelect from './select'; + +describe('', () => { + it('should emit sl-change when the value changes', async () => { + const el = (await fixture(html` + + Option 1 + Option 2 + Option 3 + + `)) as SlSelect; + const changeHandler = sinon.spy(); + + el.addEventListener('sl-change', changeHandler); + el.value = 'option-2'; + await waitUntil(() => changeHandler.calledOnce); + + expect(changeHandler).to.have.been.calledOnce; + }); +});