mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 10:51:06 +00:00
test(form): add unit tests
This commit is contained in:
parent
9a81cd2c2f
commit
dc84b133d7
3 changed files with 80 additions and 56 deletions
22
tests/Form/Form.test.svelte
Normal file
22
tests/Form/Form.test.svelte
Normal file
|
@ -0,0 +1,22 @@
|
|||
<script lang="ts">
|
||||
import { Form, FormGroup, Checkbox, Button } from "carbon-components-svelte";
|
||||
|
||||
export let preventDefault = false;
|
||||
</script>
|
||||
|
||||
<Form
|
||||
data-testid="form"
|
||||
on:submit={(e) => {
|
||||
if (preventDefault) {
|
||||
e.preventDefault();
|
||||
}
|
||||
console.log("submit", e);
|
||||
}}
|
||||
>
|
||||
<FormGroup legendText="Checkboxes">
|
||||
<Checkbox id="checkbox-0" labelText="Checkbox Label" checked />
|
||||
<Checkbox id="checkbox-1" labelText="Checkbox Label" />
|
||||
<Checkbox id="checkbox-2" labelText="Checkbox Label" disabled />
|
||||
</FormGroup>
|
||||
<Button type="submit">Submit</Button>
|
||||
</Form>
|
Loading…
Add table
Add a link
Reference in a new issue