mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
test(button): add unit tests
This commit is contained in:
parent
4466f7ec91
commit
914f300640
3 changed files with 154 additions and 61 deletions
45
tests/Button/Button.test.svelte
Normal file
45
tests/Button/Button.test.svelte
Normal file
|
@ -0,0 +1,45 @@
|
|||
<script lang="ts">
|
||||
import { Button } from "carbon-components-svelte";
|
||||
import Add from "carbon-icons-svelte/lib/Add.svelte";
|
||||
</script>
|
||||
|
||||
<Button>primary</Button>
|
||||
<Button kind="secondary">secondary</Button>
|
||||
<Button kind="tertiary">tertiary</Button>
|
||||
<Button kind="ghost">ghost</Button>
|
||||
<Button kind="danger">danger</Button>
|
||||
<Button kind="danger-tertiary">danger-tertiary</Button>
|
||||
<Button kind="danger-ghost">danger-ghost</Button>
|
||||
|
||||
<Button size="field">field size</Button>
|
||||
<Button size="small">small size</Button>
|
||||
|
||||
<Button
|
||||
icon={Add}
|
||||
tooltipPosition="bottom"
|
||||
tooltipAlignment="center"
|
||||
iconDescription="Tooltip text"
|
||||
/>
|
||||
|
||||
<Button href="#">Link button</Button>
|
||||
|
||||
<Button as let:props>
|
||||
<p {...props}>Custom element</p>
|
||||
</Button>
|
||||
|
||||
<Button disabled>Disabled button</Button>
|
||||
|
||||
<Button icon={Add}>With icon</Button>
|
||||
|
||||
<Button
|
||||
data-testid="btn"
|
||||
on:click={() => {
|
||||
console.log("click");
|
||||
}}
|
||||
>
|
||||
Test button
|
||||
</Button>
|
||||
|
||||
<Button skeleton />
|
||||
<Button skeleton size="field" />
|
||||
<Button skeleton size="small" />
|
Loading…
Add table
Add a link
Reference in a new issue