cli {
name = "components-demo"
path = "./target/debug/examples/components_demo"
alias = "demo"
}
example "select" {
title = "Select Component Demo"
description = "Single-choice selection with keyboard navigation"
steps = [
{
description = "Select first option (default)"
commands = ["select"]
input_events = [
{ key = "Enter" }
]
},
{
description = "Navigate and select third option"
commands = ["select"]
input_events = [
{ key = "Down" },
{ key = "Down" },
{ key = "Enter" }
]
}
]
}
suite "select component tests" {
test "select first option" {
description = "Test selecting the first option (default)"
commands = ["select"]
input_events = [
{ key = "Enter" }
]
assertions = [
{ type = "contains", stream = "stdout", value = "Component returned: String(\"opt1\")" }
]
}
test "select second option" {
description = "Test navigating down and selecting second option"
commands = ["select"]
input_events = [
{ key = "Down" },
{ key = "Enter" }
]
assertions = [
{ type = "contains", stream = "stdout", value = "Component returned: String(\"opt2\")" }
]
}
test "select third option" {
description = "Test navigating to third option"
commands = ["select"]
input_events = [
{ key = "Down" },
{ key = "Down" },
{ key = "Enter" }
]
assertions = [
{ type = "contains", stream = "stdout", value = "Component returned: String(\"opt3\")" }
]
}
}