test(copy-button): add unit tests

This commit is contained in:
Eric Liu 2025-03-15 17:50:24 -07:00
commit 9b3f2e0919
3 changed files with 95 additions and 11 deletions

View file

@ -0,0 +1,26 @@
<script lang="ts">
import { CopyButton } from "carbon-components-svelte";
</script>
<CopyButton
text="text"
iconDescription="Basic"
on:copy={() => {
console.log("copied");
}}
/>
<CopyButton
iconDescription="Custom feedback"
text="text"
feedback="Copied to clipboard"
feedbackTimeout={0}
/>
<CopyButton
text="Custom copy function"
iconDescription="Custom copy function"
copy={(text) => {
console.log(`Custom copy: ${text}`);
}}
/>