carbon-components-svelte/tests/RadioButton/RadioButton.test.svelte
Eric Liu 1462e300d6
fix(radio-button): forward focus, blur events (#2135)
As identified in #2131, `focus` and `blur` events should be
forwarded to the underlying `RadioButton` element.
2025-03-22 13:02:28 -07:00

38 lines
1.1 KiB
Svelte

<script lang="ts">
import { RadioButton } from "carbon-components-svelte";
import type { ComponentProps } from "svelte";
export let value: ComponentProps<RadioButton>["value"] = "";
export let checked: ComponentProps<RadioButton>["checked"] = false;
export let disabled: ComponentProps<RadioButton>["disabled"] = false;
export let required: ComponentProps<RadioButton>["required"] = false;
export let labelPosition: ComponentProps<RadioButton>["labelPosition"] =
"right";
export let labelText: ComponentProps<RadioButton>["labelText"] = "Option 1";
export let hideLabel: ComponentProps<RadioButton>["hideLabel"] = false;
export let id: ComponentProps<RadioButton>["id"] = "ccs-test";
export let name: ComponentProps<RadioButton>["name"] = "test-group";
export let ref: ComponentProps<RadioButton>["ref"] = null;
</script>
<RadioButton
bind:value
{checked}
{disabled}
{required}
{labelPosition}
{labelText}
{hideLabel}
{id}
{name}
{ref}
on:focus={() => {
console.log("focus");
}}
on:blur={() => {
console.log("blur");
}}
on:change={() => {
console.log("change");
}}
/>