test(fluid-form): add unit tests

This commit is contained in:
Eric Liu 2025-04-12 13:30:06 -07:00
commit 823a8f69dc
3 changed files with 85 additions and 17 deletions

View file

@ -0,0 +1,27 @@
<script lang="ts">
import {
FluidForm,
FormGroup,
Checkbox,
Button,
} from "carbon-components-svelte";
export let preventDefault = false;
</script>
<FluidForm
data-testid="fluid-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>
</FluidForm>