cli {
name = "components-demo"
path = "./target/debug/examples/components_demo"
alias = "demo"
}
example "multiselect" {
title = "MultiSelect Component Demo"
description = "Multiple-choice selection with space bar toggling"
steps = [
{
description = "Select single item"
commands = ["multiselect"]
input_events = [
{ key = " " },
{ key = "Enter" }
]
},
{
description = "Select multiple items"
commands = ["multiselect"]
input_events = [
{ key = " " },
{ key = "Down" },
{ key = " " },
{ key = "Down" },
{ key = " " },
{ key = "Enter" }
]
}
]
}
suite "multiselect component tests" {
test "select no items" {
description = "Test submitting without selecting anything"
commands = ["multiselect"]
input_events = [
{ key = "Enter" }
]
assertions = [
{ type = "contains", stream = "stdout", value = "Component returned: Array([" }
]
}
test "select first item" {
description = "Test selecting first item with space"
commands = ["multiselect"]
input_events = [
{ key = " " },
{ key = "Enter" }
]
assertions = [
{ type = "contains", stream = "stdout", value = "item1" }
]
}
test "select multiple items" {
description = "Test selecting multiple items"
commands = ["multiselect"]
input_events = [
{ key = " " },
{ key = "Down" },
{ key = " " },
{ key = "Enter" }
]
assertions = [
{ type = "contains", stream = "stdout", value = "item1" },
{ type = "contains", stream = "stdout", value = "item2" }
]
}
}