cli {
name = "components-demo"
path = "./target/debug/examples/components_demo"
alias = "demo"
}
example "input" {
title = "Input Component Demo"
description = "Text input field with cursor navigation"
steps = [
{
description = "User enters a simple name"
commands = ["input"]
input_events = [
{ text = "Alice" },
{ key = "Enter" }
]
},
{
description = "User enters text with spaces"
commands = ["input"]
input_events = [
{ text = "Hello World" },
{ key = "Enter" }
]
}
]
}
suite "input component tests" {
test "basic text input" {
description = "Test basic text input with Enter"
commands = ["input"]
input_events = [
{ text = "John" },
{ key = "Enter" }
]
assertions = [
{ type = "contains", stream = "stdout", value = "Component returned: String(\"John\")" }
]
}
test "empty input" {
description = "Test submitting empty input"
commands = ["input"]
input_events = [
{ key = "Enter" }
]
assertions = [
{ type = "contains", stream = "stdout", value = "Component returned: String(\"\")" }
]
}
test "input with spaces" {
description = "Test input with spaces"
commands = ["input"]
input_events = [
{ text = "Hello World" },
{ key = "Enter" }
]
assertions = [
{ type = "contains", stream = "stdout", value = "Component returned: String(\"Hello World\")" }
]
}
}