test(select): add unit tests (#2109)

This commit is contained in:
Eric Liu 2025-03-06 18:32:22 -08:00 committed by GitHub
commit 5522c5b0b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 306 additions and 64 deletions

View file

@ -0,0 +1,21 @@
<script lang="ts">
import {
Select,
SelectItem,
SelectItemGroup,
} from "carbon-components-svelte";
export let selected: string | number | undefined = undefined;
</script>
<Select bind:selected data-testid="select-group">
<SelectItem value="default" text="Choose an option" disabled hidden />
<SelectItemGroup label="Category 1" data-testid="group-1">
<SelectItem value="option-1" text="Option 1" />
<SelectItem value="option-2" text="Option 2" />
</SelectItemGroup>
<SelectItemGroup label="Category 2" data-testid="group-2">
<SelectItem value="option-3" text="Option 3" />
<SelectItem value="option-4" text="Option 4" />
</SelectItemGroup>
</Select>