feat/e2e-testing (#31)
All checks were successful
🚀 Release / release (push) Successful in 4m7s
All checks were successful
🚀 Release / release (push) Successful in 4m7s
Reviewed-on: #31 Co-authored-by: Max Richter <max@max-richter.dev> Co-committed-by: Max Richter <max@max-richter.dev>
This commit was merged in pull request #31.
This commit is contained in:
27
packages/ui/src/lib/inputs/InputSelect.svelte.ts
Normal file
27
packages/ui/src/lib/inputs/InputSelect.svelte.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { render } from 'vitest-browser-svelte';
|
||||
import { page } from 'vitest/browser';
|
||||
import InputSelect from './InputSelect.svelte';
|
||||
|
||||
describe('InputSelect', () => {
|
||||
it('should render select element', async () => {
|
||||
render(InputSelect, { options: ['a', 'b', 'c'], value: 0 });
|
||||
|
||||
const select = page.getByRole('combobox');
|
||||
await expect.element(select).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render all options', async () => {
|
||||
render(InputSelect, { options: ['apple', 'banana', 'cherry'], value: 0 });
|
||||
|
||||
const select = page.getByRole('combobox');
|
||||
await expect.element(select).toHaveTextContent('applebananacherry');
|
||||
});
|
||||
|
||||
it('should select correct option by index', async () => {
|
||||
render(InputSelect, { options: ['first', 'second', 'third'], value: 1 });
|
||||
|
||||
const select = page.getByRole('combobox');
|
||||
await expect.element(select).toHaveTextContent('second');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user