svelte-select
svelte-select copied to clipboard
simple example with @testing-library/svelte
Fantastic package however, I seem to have hit a snug trying to set focus and find available options.
// select-component.svelte
<Select
options={[
{ value: 'val-1', label: 'label 1'},
{ value: 'val-2', label: 'label 2'}
]}
placeholder="placeholder text"
/>
//select-component.test.ts
const selectInput = getByPlaceholderText('placeholder text');
expect(selectInput).toBeTruthy(); // passed
await fireEvent.focus(selectInput);
expect(getByText('label 1')).toBeTruthy(); // failed
Would be great to have a small example on how to test