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
This commit is contained in:
1 file changed
+24
@@ -0,0 +1,24 @@
|
|||||||
|
///| 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"))
|
||||||
|
}
|
||||||
Reference in new issue
Block a user