Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple example with @testing-library/svelte #646

Open
pricetula opened this issue Nov 12, 2023 · 0 comments
Open

simple example with @testing-library/svelte #646

pricetula opened this issue Nov 12, 2023 · 0 comments

Comments

@pricetula
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant