test(text-input): add unit tests

This commit is contained in:
Eric Liu 2025-03-20 12:39:51 -07:00
commit eb413a1fba
4 changed files with 260 additions and 45 deletions

View file

@ -0,0 +1,55 @@
<script lang="ts">
import { TextInput } from "carbon-components-svelte";
import type { ComponentProps } from "svelte";
export let value: ComponentProps<TextInput>["value"] = "";
export let placeholder = "";
export let size: ComponentProps<TextInput>["size"] = undefined;
export let light = false;
export let disabled = false;
export let helperText = "";
export let labelText = "User name";
export let hideLabel = false;
export let invalid = false;
export let invalidText = "";
export let warn = false;
export let warnText = "";
export let id = "ccs-test";
export let name: ComponentProps<TextInput>["name"] = undefined;
export let ref: ComponentProps<TextInput>["ref"] = null;
export let required = false;
export let inline = false;
export let readonly = false;
export let type: ComponentProps<TextInput>["type"] = "text";
</script>
<TextInput
bind:value
{placeholder}
{size}
{light}
{disabled}
{helperText}
{labelText}
{hideLabel}
{invalid}
{invalidText}
{warn}
{warnText}
{id}
{name}
{ref}
{required}
{inline}
{readonly}
{type}
on:change
on:input
on:keydown
on:keyup
on:focus
on:blur
on:paste
/>
<div data-testid="value">{value}</div>