test(expandable-tile): add unit tests

This commit is contained in:
Eric Liu 2025-03-20 15:50:54 -07:00
commit 3ccd0ea56d
5 changed files with 263 additions and 22 deletions

View file

@ -0,0 +1,31 @@
<script lang="ts">
import { ExpandableTile, Button } from "carbon-components-svelte";
export let buttonClicked = false;
export let linkClicked = false;
</script>
<ExpandableTile tileExpandedLabel="View less" tileCollapsedLabel="View more">
<div slot="above">
<a
href="/"
data-testid="test-link"
on:click|preventDefault|stopPropagation={() => {
linkClicked = true;
}}
>
Test link
</a>
<br /><br />
<Button
data-testid="test-button"
on:click={(e) => {
e.stopPropagation();
buttonClicked = true;
}}
>
Test button
</Button>
</div>
<div slot="below">Below the fold content here</div>
</ExpandableTile>