Files
chandra/compositor/shell/config_rows_wbtest.mbt
T
Claude da56f59cf7
CI / test (push) Failing after 18s
Shell: test that module settings menus have no blank rows
The dock keeps its pinned apps as a setting with an empty label; the settings menu must skip it
(c45e0ef) rather than draw an unlabeled row. Cover config_rows directly and with the dock's real
settings, on the wasm target (no wasmer needed). No other module declares an empty label or choice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hkqAzaoEVwZmqjUx99
2026-11-25 22:25:24 +00:00

25 lines
1.2 KiB
MoonBit

///| A module's settings menu never has a blank row: a setting with an empty label is kept by the
/// module (the dock's pinned apps) but not listed, and every listed row has a label.
test "settings menu rows: hidden settings are skipped, no blank rows" {
let items : Array[@wasm.ConfigItem] = [
{ key: "size", label: "Icon size", choices: ["Small", "Large"], value: "Small" },
{ key: "magnify", label: "Magnify", choices: [], value: "on" },
{ key: "pinned", label: "", choices: [], value: "foot;gimp" },
]
let rows = config_rows(items)
assert_eq(rows.map(r => r.label), ["Icon size", "Small", "Large", "Magnify"])
assert_true(rows.iter().all(r => r.label.length() > 0))
}
///| The dock's real settings, as its module declares them.
test "dock settings menu has no blank rows" {
let c = @dock.DockConfig::from_pairs([("pinned", "foot;gimp")])
let items = c
.items()
.map(it => ({ key: it.key, label: it.label, choices: it.choices, value: it.value } : @wasm.ConfigItem))
let rows = config_rows(items)
assert_true(rows.length() > 0)
assert_true(rows.iter().all(r => r.label.length() > 0))
assert_false(rows.iter().any(r => r.arg == "pinned"))
}