mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 10:51:06 +00:00
test(dropdown): add unit tests
This commit is contained in:
parent
e5ab55858f
commit
4258e233b8
4 changed files with 344 additions and 115 deletions
25
tests/Dropdown/DropdownSlot.test.svelte
Normal file
25
tests/Dropdown/DropdownSlot.test.svelte
Normal file
|
@ -0,0 +1,25 @@
|
|||
<script lang="ts">
|
||||
import { Dropdown } from "carbon-components-svelte";
|
||||
import type { ComponentProps } from "svelte";
|
||||
|
||||
export let items: ComponentProps<Dropdown>["items"] = [
|
||||
{ id: "0", text: "Option 1" },
|
||||
{ id: "1", text: "Option 2" },
|
||||
{ id: "2", text: "Option 3" },
|
||||
];
|
||||
export let selectedId: ComponentProps<Dropdown>["selectedId"] = "0";
|
||||
export let id: ComponentProps<Dropdown>["id"] = "test-dropdown-slot";
|
||||
</script>
|
||||
|
||||
<Dropdown
|
||||
{items}
|
||||
{selectedId}
|
||||
{id}
|
||||
titleText="Custom slot dropdown"
|
||||
let:item
|
||||
let:index
|
||||
>
|
||||
<span data-testid="custom-item">
|
||||
Item {index + 1}: {item.text}
|
||||
</span>
|
||||
</Dropdown>
|
Loading…
Add table
Add a link
Reference in a new issue